Hallo
Schon klar, aber gerade als Anfänger würde ich nie ungeprüften (= auf dem eigenen asuro getestet) Code abliefern. Obwohl ich mich inzwischen seit über einem Jahr mit dem asuro beschäftige mache ich das auch nur sehr selten (und es geht auch meist schief).Bin ja bis jetzt auch noch ein Anfänger würde ich sagen ...
Natürlich kann man auch eine Funktion basteln oder die Tasten als Menu mit Case auswerten:
Oje, wir driften wieder ins OffTopic..Code:#include "asuro.h" unsigned char t1, t2; int main(void){ Init(); while(1) { t1=PollSwitch(); t2=PollSwitch(); if (t1 == t2) switch(t1){ case 1: BackLED(OFF,ON); break; case 32: BackLED(ON,OFF); break; case 4: StatusLED(YELLOW); break; case 8: StatusLED(GREEN); break; case 2: MotorSpeed(0,150); break; case 16: MotorSpeed(150,0); break; case 18: FrontLED(ON); MotorSpeed(150,150); break; default: BackLED(OFF,OFF); FrontLED(OFF); \ StatusLED(RED); MotorSpeed(0,0); break; } // Ende if/switch } // Ende Main return 0; }
... und sind wieder drin *grins*Code:#include "asuro.h" unsigned char t1, t2; unsigned int loop_count; int main(void){ Init(); loop_count = 0; while(1) { t1 = PollSwitch(); t2 = PollSwitch(); if (t1 && (t1 == t2)) { MotorDir(RWD,RWD); MotorSpeed(100,200); for(t1=255; t1; t1--) Sleep(127); MotorSpeed(0,0); MotorDir(FWD,FWD); loop_count=0; } if (loop_count < 2000) { loop_count = loop_count + 1; MotorSpeed(loop_count/10,loop_count/10); } } // Ende Mainloop return 0; }
Gruß
mic







Zitieren

Lesezeichen