Hi team
Following code snap for rotate the robot at Left Right and Around
In this case delay is used to decide the value of angle robot to be rotated
Once we set the delay value for example 90 degree it is working fine
But due to decay of battery voltage the motor speed can be reduced So previously set angle can be changed
as a solution we can use
for example turn Left
we can rotate robot until sensor one reached the black line and then stop the rotation
Hope above solution is worked
But I don’t understand how it write properly using coding
Hi expert…Can you please help me to write it
Thanks in advanced
void turn(unsigned char dir)
{
switch(dir)
{
case 'L':
// Turn left.
OrangutanMotors::setSpeeds(-80, 80);
delay(200);
break;
case 'R':
// Turn right.
OrangutanMotors::setSpeeds(80, -80);
delay(200);
break;
case 'B':
// Turn around.
OrangutanMotors::setSpeeds(80, -80);
delay(400);
break;
case 'S':
// Don't do anything!
break;
}
}