We're sorry, but you must have Javascript enabled in your browser to access this exercise.

Set Movement

Define the speed of the robot's left and right motors so it can: go Forward, turn Left, turn Right, go Backward and Stop. Speeds should be integers, as in the first exercise.

You press the appropriate button so the robot goes Forward, Left, etc.

You can add a race Track and Go Racing, and do a return race - in the opposite direction.

Keyboard controls

F L R B S make the robot obey the speeds you have defined.

D is for defining the speeds: initially for the Forward left speed: use the tab key to move to the next speed, shift tab goes back a speed.

A sets a plain arena, T the race track, G means go racing, U sets a return race, W toggles Reverse Left Motor.

I, J, K, M move the robot Up, Left, Right or Down.

Exercise Tasks

First define the 5 speed pairs for moving the robot Forward/Left/Right/Backwards or Stop. Then check the robot moves as you expect.

Press T for track and then Go Racing - see how quickly you can steer to the middle.

Try a few times, and also try a return race. Note your fastest time.

Reverse Left Motor

return race

Left motor   Right motor

Left motor   Right motor

Left motor   Right motor

Left motor   Right motor

Left motor   Right motor

Arena Track