00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "asuro.h"
00013
00014 unsigned char Wheelspeed[2];
00015
00016 #define aus MotorDir(BREAK,BREAK)
00017 void testfahrt(void)
00018 {
00019 unsigned char s1=100,s2=100;
00020
00021 MotorSpeed(150,150);
00022 MotorDir(FWD,FWD);
00023
00024 while (1)
00025 {
00026 if (Wheelspeed[0]<150)s1++;
00027 if (Wheelspeed[0]>160)s1--;
00028 if (Wheelspeed[1]<150)s2++;
00029 if (Wheelspeed[1]>160)s2--;
00030
00031 Msleep(2);
00032 MotorSpeed(s1,s2);
00033
00034 SerWrite("\n\r speed Left,Right ",21);
00035
00036 PrintInt(Wheelspeed[0]);
00037 PrintInt(Wheelspeed[1]);
00038 }
00039 }
00040 void treasure(void)
00041 {
00042 Go(350,150);
00043 Go(-50,150);
00044 Msleep(1000);
00045
00046 Turn(90,150);
00047 Go(100,150);
00048 Turn(-90,150);
00049 Go(170,150);
00050 Turn(-90,150);
00051 Go(100,150);
00052 Turn(-90,150);
00053
00054 Go(470,150);
00055 Go(-50,150);
00056
00057 Msleep(1000);
00058 Turn(90,150);
00059 Go(100,150);
00060 Turn(-90,150);
00061 Go(170,150);
00062 Turn(-90,150);
00063 Go(100,150);
00064 Turn(-90,150);
00065 }
00066
00067 int main(void)
00068 {
00069 int n;
00070
00071 Init();
00072 EncoderInit();
00073 StatusLED(OFF);
00074 SerWrite("\n\r motor calibration V0.1 \n\r",28);
00075 while (1)
00076 {
00077 n=PollSwitch ();
00078 if (n==8)
00079 {
00080 SerWrite("\n\r testfahrt \n\r",15);
00081 Msleep(3000);
00082 testfahrt();
00083 }
00084 if (n==16)
00085 {
00086 SerWrite("\n\r treasure \n\r",14);
00087 Msleep(3000);
00088 treasure();
00089 }
00090
00091 StatusLED(RED);
00092 Msleep(500);
00093 StatusLED(GREEN);
00094 Msleep(500);
00095 }
00096 return 0;
00097 }