Ultrasonic Obstacle Detection

Ultrasonic Obstacle Detection has 3 modes. Mode 0 (which is also activated at startup) is the standby mode. This can be recognized by the fact that the warning lights are on and an x is displayed on the LED matrix of the micro:bit. The standby mode can be activated by pressing buttons A and B at the same time. If button A is pressed, mode 1 is activated and an arrow in the direction of the rear of the joy car appears on the LED matrix. If an object comes closer than 20 cm from the front of the Joy-Car, the Joy-Car moves back. Pressing button B activates mode 2 and an arrow appears on the LED matrix in the direction of travel. Now the Joy-Car drives forward until an obstacle comes within 40 cm of the Joy-Car.