Chapter 8.3 - Follow the light

First, you have to create two word (16-bit) variables: Left_Light and Right_light

Write the following program to have the Edison robot follow light from a torch/flashlight.


Shine a torch/flashlight at Edison and the robot will drive towards the light.

This program performs a calculation between two variables. In the calculate word icon the variable Right_Light is subtracted from the variable Left_Light. The result (answer) is placed back into the variable Right_Light. Let’s see what the results would look like:


From the above you can see that when the torch is to the right the result is below zero (negative number). When the torch is to the left the result is above zero (positive number).

The If icon asks: Is the result less than zero? If true the robot drives left (towards the light), if false the robot drives right (towards the light).