??
智能小车红外避障c语言程序
#include
bit RandomFactor = 0 ;bit RandomFactorBuf = 0 ;#include
#define FLeftMotor P0_2 = 1 ; P0_3 = 0 #define BLeftMotor P0_2 = 0 ; P0_3 = 1
#define FRightMotor P0_5 = 1 ; P0_4 = 0 #define BRightMotor P0_5 = 0 ; P0_4 = 1
#define LeftStop??? P0_2 = 0 ; P0_3 = 0 #define RightStop?? P0_4 = 0 ; P0_5 = 0
#define CarStop P0_2 = 0 ; P0_3 = 0 ; P0_4 = 0 ; P0_5 = 0
#define RightSenser P0_0 #define LeftSenser P0_1
//********************************************************
// 左转
//********************************************************
void TurnLeft_1(){LeftStop ;FRightMotor ;
}
//********************************************************
// 快速左转
//********************************************************void TurnLeft_Fast(){BLeftMotor ;FRightMotor ;}
//********************************************************
// 右转
//********************************************************void TurnRight_1(){RightStop ;FLeftMotor ;}
//********************************************************
// 快速右转
//********************************************************void TurnRight_Fast(){BRightMotor ;FLeftMotor ;}
//********************************************************
// 用倒退的方式进行车头右转
//********************************************************void BTurnRight_1(){LeftStop ;BRightMotor ; }
//********************************************************
// 用倒退的方式进行车头左转
//********************************************************void BTurnLeft_1(){ RightStop ;BLeftMotor ; }
//********************************************************
// 前进
//********************************************************
void FCar(){FLeftMotor ;FRightMotor ;}
//********************************************************
// 后退
//********************************************************void BCar(){BLeftMotor ;BRightMotor ;}
//********************************************************
// 壁障程序//********************************************************void Obstac