Ultrasonic sensor

The ultrasonic sensor can be used for the development of an autonomous vehicle among other things. At the Calliope office in Berlin, such a sensor is used to welcome visitors: the sensor monitors the door and as soon as someone moves through the entrance, the Calliope mini controls a small greeting card module which then plays a greeting message.

Further information to the sensor you will find here.
Ultrasonic sensor can be ordered here.

port: A1
interface: PWM
output values

2 - 350 cm

Makecode

To see the current value of the ultrasonic sensor on the LED display, you can use the "show number 0" block from the "Basics" category. To recognize the ultrasonic sensor, the respective value of the pin on which the sensor sends the data must be queried. With the ultrasonic sensor, the measured values must be compared within a short time to determine the distance. This can be programmed by querying the active pin (C16).
But there is also a simpler way! To do this, a package is imported which does the calculation. This package can be loaded by selecting the item "Extensions" under "Advanced". Then a new window appears, in which the extensions are listed (by using the search input, these can be searched and many more can be found). Here the package "Grove" must be selected. The window is closed and the item "Grove" can be selected in the menu bar. Here you can find the block "Ultrasonic sensor (in cm) at C16". This block is used to output the distance of an object to the ultrasonic sensor in centimeters. To see this value, the block is inserted into the "show number" block instead of the "0".

video hex

Open Roberta Lab

In the overview gallery in the Open Roberta the shown example program with documentation of the ultrasonic sensor is stored.
The best way to open the example program in the gallery is to enter "Grove_UltraSonicRanger" into the search mask.

video xml

You can find sensor and actuator projects that have already been realised on the project page.

Other Projects