📄 main._c
字号:
/*******************************************************************************
** 文件名:main.c 工程主文件
*******************************************************************************/
#include "config.h"
volatile uint8 flag; //小车状态
//0未偏 1左偏 2右偏 3前出线 4后出线 5脱轨
/*void main(void)
{
init_devices();
straight();
flag_test(); //测试小车状态
while(1) //没有脱轨
{
flag_test();
switch(flag)
{
case 0: //正常情况将速度设成相等
motor_right_speed_set(0xFE);
motor_left_speed_set(0xFE);
break;
case 1:
mic_turn_right();
break;
case 2:
mic_turn_left();
break;
case 3:
break;
case 4:
break;
case 5:
stop();
break;
default:
break;
}
}
}/end main*/
// moto test *****************************************************************
void main(void)
{
init_devices();
init_devices();
while(1)
{
//DDRD=0XFF;
//PORTD=0X00;
//
//motor_left_forward(0x00);
//Delay1ms(100);
//stop();
//Delay1ms(100);
motor_right_forward(0xFF);
Delay1ms(100);
//stop();
//Delay1ms(100);
//straight();
//Delay1ms(100);
//turn_left();
//Delay1ms(100);
//turn_right();
//Delay1ms(100);
//straight_back();
//Delay1ms(100);
//mic_turn_left();
//Delay1ms(100);
//mic_turn_right();
//Delay1ms(100);
//stop();
//Delay1ms(500);
}
}
//*******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -