Skip to the content.

robot controlled by gestures

The program starts by setting the radio group displayed by the robot micro:bit. This is the same group that the microcode program will use to communicate with the robot. In this example, we use 3 dots but this is probably different for your robot.

when page starts, set radio group of robot

Microcode assumes that the robot has 2 line sensors at the front of the robot (some have more). Each following rule handle one possible state of the sensor and tell the robot where to go accordingly.

when both line detected, robot move forward

When both lines both lines are detected, motor forward move the robot forward.

when line detected on left sensor, robot turn left

When the left line left sensor detects the line, the robot is starting to lose the line trajectory and we tell the robot to motor turn left turn left.

when line detected on right sensor, robot turn right

The same logic is applied for the right sensor.

when line lost from left, robot spin left

When the left lost line left sensor also stops detecting the line, the robot completely lost the line but we know that the line was on the left. We tell the robot to motor spin left spin right (harder turn) to aggressively go back to detecting the line.

when line lost from right, robot spin right

The same logic is applied for the right sensor.

Tips about line following