{ Serial.println("left"); driveMode = DRIVE_LEFT; } //ESCAPE if(leftDistance<THRESHOLD && rightDistance<THRESHOLD) driveMode = ESCAPE; } void loop() { //ENTER STOP MODE if(digitalRead(STOP_PIN)==HIGH) { Serial.println("Stop Mode"); digitalWrite(ENABLE_RIGHT_MOTOR, HIGH); digitalWrite(ENABLE_LEFT_MOTOR, HIGH); while(1) if(digitalRead(STOP_PIN)==LOW) break; delay(100); } else digitalWrite(ENABLE_RIGHT_MOTOR, LOW); digitalWrite(ENABLE_LEFT_MOTOR, LOW); if(digitalRead(TRACK_PIN)==HIGH) {//////////////////////////////////////////// //ENTER TRACKING MODE while(1) { Serial.println("Tracking Mode"); if(digitalRead(TRACK_PIN)==LOW) break; previousDriveMode = driveMode; if(digitalRead(SIGNAL_LEFT)==HIGH) { driveMode = DRIVE_LEFT; Serial.print("Drive Left fuck "); } if (digitalRead(SIGNAL_RIGHT)==HIGH) { driveMode = DRIVE_RIGHT; Serial.print("Drive Right "); } if(digitalRead(SIGNAL_LEFT)==LOW && digitalRead(SIGNAL_RIGHT)==LOW) { driveMode = DRIVE_FORWARD; Serial.print("Drive Forward ");
{ Serial.println("left"); driveMode = DRIVE_LEFT; } //ESCAPE if(leftDistance<THRESHOLD && rightDistance<THRESHOLD) driveMode = ESCAPE; } void loop() { //ENTER STOP MODE if(digitalRead(STOP_PIN)==HIGH) { Serial.println("Stop Mode"); digitalWrite(ENABLE_RIGHT_MOTOR, HIGH); digitalWrite(ENABLE_LEFT_MOTOR, HIGH); while(1) if(digitalRead(STOP_PIN)==LOW) break; delay(100); } else digitalWrite(ENABLE_RIGHT_MOTOR, LOW); digitalWrite(ENABLE_LEFT_MOTOR, LOW); if(digitalRead(TRACK_PIN)==HIGH) {//////////////////////////////////////////// //ENTER TRACKING MODE while(1) { Serial.println("Tracking Mode"); if(digitalRead(TRACK_PIN)==LOW) break; previousDriveMode = driveMode; if(digitalRead(SIGNAL_LEFT)==HIGH) { driveMode = DRIVE_LEFT; Serial.print("Drive Left fuck "); } if (digitalRead(SIGNAL_RIGHT)==HIGH) { driveMode = DRIVE_RIGHT; Serial.print("Drive Right "); } if(digitalRead(SIGNAL_LEFT)==LOW && digitalRead(SIGNAL_RIGHT)==LOW) { driveMode = DRIVE_FORWARD; Serial.print("Drive Forward ");