hab meinen Asuro jetzt wie folgt programmiert:
#include "asuro.h"
(alt+c)Code:int main(void) { int a; Init(); while(1) { MotorDir(FWD,FWD); MotorSpeed(200,200); StatusLED(GREEN); while (PollSwitch()==0)//fahren bis kollision { MotorSpeed(0,0); //bei kollision, motoren abstellen StatusLED(YELLOW);//nachdenken was passiert ist: unsigned char taste; taste = PollSwitch(); if (taste == 32 || taste == 48) //links kollidiert { MotorDir(BREAK,RWD); MotorSpeed(0,120); for(a=0;a<500;a++) {Sleep(72);}//ca. eine ms } //sollte ca 0.5sec "Pause" sein else if (taste == 16 || taste == 8 || taste == 4 || taste == 2 || taste == 18) //einige Frontalkollisionen { MotorDir(RWD,RWD); MotorSpeed(120,120); for(a=0;a<500;a++) {Sleep(72);} MotorDir(RWD,FWD); for(a=0;a<500;a++) {Sleep(72);}} else if (taste == 1 || taste == 3)//rechts kollidiert { MotorDir(RWD,BREAK); MotorSpeed(120,0); for(a=0;a<500;a++) {Sleep(72);}} else//unbekanntes kollisionsmuster { while(1) {StatusLED(RED); BackLED(ON,OFF); Sleep(100); BackLED(OFF,ON); for(a=0;a<500;a++) {Sleep(72);}} } } }//nach dem "Ausweichen" wieder fahren return 0; }
wenn ich ichn jetzt einschalte leuchten wieder meine BackLED und meine StatusLED rot und mehr macht das gute stück dann nicht mehr...







Zitieren

Lesezeichen