Das wird schon :)
Ein Ansatz für die Kontrolle der mit PollSwitch() ermittelten Werte:
Wobei mir diese Variante eigentlich besser gefällt:Code:#include "asuro.h" char t1,t2; void ms_pause(unsigned int p) { while(p--) Sleep(72); } int main(void) { Init(); MotorSpeed(150,150); while(1) { t1=PollSwitch(); t2=PollSwitch(); if((t1>0) && (t1==t2)) { StatusLED(RED); MotorDir(BREAK, BREAK); ms_pause(100); MotorDir(RWD,RWD); MotorSpeed(120,150); ms_pause(1000); StatusLED(GREEN); MotorDir(BREAK, BREAK); ms_pause(100); MotorDir(FWD,FWD); MotorSpeed(150,150); } } while (1); return 0; }
Beides nicht getestet!Code:#include "asuro.h" char t1,t2; void ms_pause(unsigned int p) { while(p--) Sleep(72); } int main(void) { Init(); MotorSpeed(150,150); t2=PollSwitch(); while(1) { t1=PollSwitch(); if((t1>0) && (t1==t2)) { StatusLED(RED); MotorDir(BREAK, BREAK); ms_pause(100); MotorDir(RWD,RWD); MotorSpeed(120,150); ms_pause(1000); StatusLED(GREEN); MotorDir(BREAK, BREAK); ms_pause(100); MotorDir(FWD,FWD); MotorSpeed(150,150); } t2=t1; } while (1); return 0; }
Gruß
mic






Zitieren

Lesezeichen