Code:#include "asuro.h" #include "stdlib.h" int main(void) { int x=0,LANG=0,z=0,t=0; unsigned int data[2]; char data0[5], data1[5]; Init(); /* x++; if (x > 1000) LANG++; if (x > 1000) x = 0; */ while( 1 ) { char message[] = "1"; SerRead(message,1,1); if(message[0] == 'G') { FrontLED(ON); { // ein Block LineData(data); itoa (data[0], data0, 5); itoa (data[1], data1, 5); SerWrite (data0, 4); SerWrite (" links\n\r", 8); SerWrite (data1, 4); SerWrite (" rechts\n\r", 9); for (t=0; t < 2; t++) { Sleep (72); } // for } // ein Block { // noch ein Block MotorDir(FWD,FWD); MotorSpeed(110,100); BackLED(OFF,OFF); if ( data[0] < 50 ) { MotorDir(RWD,RWD); MotorSpeed(100,150); BackLED(ON,OFF); for(z=0 ; z < 40 ; z++) { Sleep(216); } // for } // if if ( data[1] < 50 ) { MotorDir(RWD,RWD); MotorSpeed(100,150); BackLED(OFF,ON); for(z=0 ; z < 40 ; z++) { Sleep(216); } // for } // if } // noch ein Block if (PollSwitch() >= 1) { MotorDir(RWD,RWD); MotorSpeed(255,255); BackLED(OFF,OFF); StatusLED(RED); for(z=0 ; z < 100 ; z++) { Sleep(216); } // for } // if PollSwitch() } // if(message[0] == 'G') if(message[0] == 'S') { MotorDir(FREE,FREE); FrontLED(OFF); //Dieser Teil müste eigentlich so funktonieren oder StatusLED(OFF); } // if(message[0] == 'S') } // while( 1 ) return 0; } //main(void)
Aktueller stand







Zitieren

Lesezeichen