Below, you will find the intelligent function of the Joy-Car.

To use this function, you must have the ultrasonic sensor mounted onto the servo motor.

With this function, you can detect while driving whether an obstacle is approaching from one side in which the ultrasonic sensor rotates using the servo motor.

Intelligent Obstacle Detection

This function returns a value that indicates whether something was detected and also in which direction the obstacle was detected.


Return value Direction
0 found nothing
1 left
2 in front
3 right

Simple example

In this example, the ultrasonic sensor rotates and the micro:bit indicates the orientation of the detected obstacle with its LED matrix.

Intelligent Obstacle detection

We now use intelligent Obstacle Detection within an obstacle course. To do this, we steer to the right if the ultrasonic sensor detects an obstacle on the left and to the left if the ultrasonic sensor detects something on the right. If the ultrasonic sensor in front of the Joy-Car detects something, we reverse a turn.

In addition, we also use obstacle sensors to prevent the Joy-Car from hitting a wall when the ultrasonic sensor is not looking in the right direction.