Light Following Robot – Coding

In this lesson will teach our robot how to follow a source of light.

Connecting electronic modules

1. Connect the motors to the M1 and M2 ports of the LOFI Brain controller. Make sure the small metal walls inside the pins of the motor cables are facing the plastic walls of the pins on the controller.

2. Connect the powerbank to the micro USB slot on the Adapter.

LOFI_Robot_Rover_assembly

3. If you are using a Bluetooth module, connect it to the corresponding slot on the adapter. Make sure you put the module in the right direction, see the picture below.

LOFI_Robot_Rover_assembly

4. Connect the light sensors to INPUT 1 and INPUT 2.

The code