hi every body
I am proagramming my mbot ranger and I would like start obstacle-avoidance mode when the robot receive the command “oto” until he receive the command “stop”
I did that
void loop()
//Read 3 character command.
char cmd[4] = “—”;
Serial.readBytes( cmd, 3 );
Serial.print(cmd);
//Execute chosen command.
if( strcmp( cmd, “upt” )==0 ) move(1, 255);
else if( strcmp( cmd, “bck” )==0 ) move(2, 255);
else if( strcmp( cmd, “lef” )==0 ) move(3, 255);
else if( strcmp( cmd, “rgt” )==0 ) move(4, 255);
else if( strcmp( cmd, “stp” )==0 ) move(1, 0);
else if( strcmp( cmd, “oto” )==0 ) ultrasonic();
else Serial.print( “Bordel!!” );
}
void ultrasonic()
{
do{
if((ultrasonic_10.distanceCm()) < (15))
{
move(1,0);
}
else
{
move(1,150);
}
}while( “stp”);
}
but my robot just move(1,150)
where is my mistake pls?