Keyestudio Micro:bit Mini Smart Robot Car V2 Instructions Manual page 112

Table of Contents

Advertisement

Programming Thinking
Set the KEYES-2812-18R module to turn on 18 RGB LEDs in various colors.
1
When micro:bit robot moves forward, 18 RGB LEDs turn on blue light;
robot moves backward, 18 RGB LEDs turn on purple light; turn left, 18 RGB LEDs turn on green light;
turn right, 18 RGB LEDs turn on yellow light; robot stops, 18 RGB LEDs turn on red light.
Measure the distance between the robot and obstacles ahead by an ultrasonic sensor. Use 2 infrared
2
detector sensors to detect the obstacles on both sides of micro:bit robot.
When the measured distance is greater than 3cm but less than or equal to 6cm, no obstacles at both sides,
3
micro:bit robot stops. If less than or equal to 3cm, obstacles detected at both sides, robot moves backward;
If greater than 6cm, no obstacles detected at both sides, robot moves forward;
If greater than 3cm, obstacles are at right side but not left side, robot turns right;
If greater than 3cm, obstacles are at left side but not right side, robot turns left;
If greater than 6cm, obstacles detected at both sides, robot moves backward;
for other status, robot stops.
86

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents