Dein Programm ist schon mal gar nicht übel! Das einzige Problem dabei: die Taster werden nur ein einziges mal abgefragt. Wenn dabei keiner gedrückt ist, fährt der Asuro einfach immer weiter.
Pack das Ganze in eine Endlosschleife und schon passt es:
Code:#include "asuro.h" int main(void) { Init(); while(1) { if (PollSwitch()==0) { MotorDir(FWD,FWD); MotorSpeed(150,170); BackLED(ON,ON); FrontLED(ON); StatusLED(GREEN); } else { MotorDir(FWD,FWD); MotorSpeed(0,0); StatusLED(RED); } } return 0; }
Lesezeichen