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

React to Lights

The arena has two lights which the robot senses with two beams. You define the speeds of the robot's motors depending on its sensors. Speeds are integers as before.

Click in the arena to reposition the robot; you can put it back in its original position; and give it wider beams.

Keyboard controls

Press D for defining the speeds: tab to next speed; S to start/stop the robot, P to put in initial position, W to toggle Reverse Left Motor, B to toggle the narrow/wide beam option.

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

Exercise Tasks

Define the robot's speeds so it steers to a light, press Start and check it works.

Select wider beams - does the robot work as well?

Try to get the robot to steer towards a light but then veer away when it is close.

When No Light is seen :

When Light just seen on left :

When Light closer on left :

When Light just seen in right :

When Light closer on right :

Reverse left motor wires

Left motor   Right motor

Left motor   Right motor

Left motor   Right motor

Left motor   Right motor

Left motor   Right motor

Wider Beams