OK, Wartung kommt nicht mehr. Mein Code sieht jetzt so aus:
Kannst du mal drübersehen? Ich habe immer noch das gleiche Problem mit dem "Rückwärtsgang".Code:#include "asuro.h" // incl. der Funktionen InitUltrasonics, RestoreAsuro, Chirp von "dopez" (roboternetz) #include "ultrasonic.h" #define MAXDIFF 80 // Sehr große Sprünge zunächst ausblenden int main(void) { int abstand, abstand_alt, diff, zaehler=0; Init(); abstand = Chirp(); while(TRUE) { abstand_alt = abstand; abstand = Chirp(); ++zaehler; diff = abstand - abstand_alt; if( (abstand>40) && (abs(diff)<MAXDIFF) ) { StatusLED(GREEN); MotorDir(FWD, FWD); MotorSpeed(150, 150); } else if( (abstand>35) && (abstand<=40) && (abs(diff)<MAXDIFF) ) { StatusLED(GREEN); MotorDir(FWD, FWD); MotorSpeed(150, 100); Msleep(30); } else { StatusLED(RED); MotorDir(RWD, RWD); MotorSpeed(100, 150); Msleep(100); } if (zaehler > 400) { StatusLED(RED); BackLED(ON,ON); MotorDir(RWD, RWD); MotorSpeed(250, 200); Msleep(10); BackLED(OFF,OFF); } if (zaehler > 405) { StatusLED(RED); BackLED(ON,ON); MotorDir(RWD, RWD); MotorSpeed(200, 250); Msleep(10); BackLED(OFF,OFF); if(zaehler > 410) zaehler = 0; } } return 0; }
Wie hast du deinen zum Laufen gebracht?







Zitieren

Lesezeichen