How do I write code so that when I push the joystick up and left at about 45 degrees, the robot turns left forward? Push the joystick up and right at about 45 degrees, the robot turns right forward. Push the joystick down and right at about 45 degrees, the robot turns right backward. Push the joystick down and left at about 45 degrees, the robot turns left backward.
if (joystick is up and joystick is left at about 45 degrees)
{
robot turns left forward
}
if (joystick is up and joystick is right at about 45 degrees)
{
robot turns right forward
}
if (joystick is down and joystick is left at about 45 degrees)
{
robot turns left backward
}
if (joystick is down and joystick is right at about 45 degrees)
{
robot turns right backward
}