update time!
also, das prog funktioniert jetzt, nur leider is das array nur ein unsigned char... als unsigned interger funzt es immernoch nicht, leider
Code:#include "asuro.h" void longsleep(unsigned int dauer) { unsigned int i; for(i=0;i<dauer;i++) { Sleep(216); } return; } int main(void) { unsigned char command[1]; Init(); while(1) { command[0]=0; StatusLED(YELLOW); SerWrite("\n\r Warte auf Kommando.\n\r",24); MotorDir(BREAK,BREAK); MotorSpeed(0,0); longsleep(50); SerRead(command,1,0); longsleep(50); if(command[0]==32) //ein Stück vorwärts fahren { StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(180,180); longsleep(400); continue; } if(command[0]==33) //ein Stück rückwärts fahren { BackLED(ON,ON); MotorDir(RWD,RWD); MotorSpeed(180,180); longsleep(400); BackLED(OFF,OFF); continue; } if(command[0]==16) //Rechtsdrehung { BackLED(OFF,ON); MotorDir(FWD,FREE); MotorSpeed(150,0); longsleep(400); BackLED(OFF,OFF); continue; } if(command[0]==17) //Linksdrehung { BackLED(ON,OFF); MotorDir(FREE,FWD); MotorSpeed(0,150); longsleep(400); BackLED(OFF,OFF); continue; //die continues musst ich ans ende einer jeden if abfrage setzen, ohne is er irgendwie nicht an den anfang zurückgekehrt } else { continue; } } return 0; }
also, wenn jemand doch noch 'ne Idee hat, das Ding auf größere Befehle auszulegen, Vorschläge sind gern gesehen
Gruß
Chris







Zitieren

Lesezeichen