Rover – Avoiding Obstacles

In this lesson, we’re about to perform a classic act of robotics – programming an obstacle avoiding robot. At first, this task may seem too complicated, but soon you will find that creating your first obstacle avoiding robot is surprisingly easy. πŸ™‚

Connecting electronic modules

1. Connect the motors to the M1 and M2 ports of the LOFI Brain. 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. Connect the distance sensor to the corresponding slot on the Adapter. Make sure you have connected the pins VCC, TRIG, ECHO, and GND as shown in the picture below.

LOFI_Robot_Rover_assembly

4. 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

The code