Detecting White Lines

Your robot should be calibrated to test for white lines.

It's important to check for the white line at the start of your loop.


void loop() {

    if(sumo.IsLightOnFrontLeft() || sumo.IsLightOnFrontRight() )
      {
        Serial.println("Is on white");
        sumo.reverse(80, 80);
        delay(270);
        sumo.left(30, 30);
        delay(250);
        
        sumo.stop();
    
      }else{
              //now start looking for other robots to attack.

      }
      
}

Last updated