?? processselector.c
字號:
#include "HardwareInfo.c"
#include <GetSelector.h>
#include "kickAndDefengsiveFootball.c"
#include "defengsiveFootball.c"
#include "kickFootball.c"
#include <GetCompoI.h>
#include <SetLCD3Char.h>
#include <GetCompassB.h>
#include <GetUltrasound.h>
// define global var
unsigned int beginDeathHeading = 0; //存儲上一循環時的角度,也就是剛卡死時的角度
unsigned long beginDeathTime = 0; //存儲上一循環時的時間,也就是剛卡死時的時間
unsigned int g_distanceLeft = 0; //存儲左超聲測距模塊的返回值
int main(void)
{
unsigned char value = 0; //程序選擇器的返回值。
unsigned char yfy = 140;
unsigned char var0 = 110;
unsigned char fyMax = 0;
unsigned char fyMin = 0;
unsigned int b = 0;
unsigned int distance_left = 0;
unsigned int distance_middle = 0;
while (1)
{
value = GetSelector(_SELECTOR_1_);
if ( value==1 )
{
break;
}
else
{
if ( value==2 )
{
break;
}
else
{
if ( value==3 )
{
break;
}
else
{
if ( value==4 )
{
break;
}
else
{
if ( value==5 )
{
break;
}
}
}
}
}
}
while ( value==1 )
{
kickAndDefengsiveFootball(15, yfy, var0, 30, 120, 60, 17, 7, 30, 190, 45, 31);
}
while ( value==2 )
{
defengsiveFootball(yfy, var0, 140, 29, 60, 7, 31, 7, 17, 30);
}
while ( value==3 )
{
kickFootball(yfy, var0, 120, 190, 29, 60, 45);
}
while ( value==4 )
{
fyMax = GetCompoI(_COMPOUNDEYE_fy_, 9);
fyMin = GetCompoI(_COMPOUNDEYE_fy_, 11);
SetLCD3Char(1, fyMax);
SetLCD3Char(9, fyMin);
}
while ( value==5 )
{
b = GetCompassB(_COMPASS_jd_);
distance_left = GetUltrasound(_ULTRASOUND_left_);
distance_middle = GetUltrasound(_ULTRASOUND_middle_);
SetLCD3Char(1, b);
SetLCD3Char(6, distance_left);
SetLCD3Char(11, distance_middle);
}
return 1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -