In this tutorial we will learn how to use HC-SR04 Ultrasonic sensor with Raspberry Pi Pico to measure the obstacle distance and use integrated LED as a warning. Once the distance is smaller then 10cm the LED will activate and the shorter the distance the faster the LED will blink.
Watch the video!
"Map Range Analog" component will transform our distance from the ultrasonic sensor to the Frequency of the LED blinking
Select "MapRange1" and in the properties window set "Input Range" > "Max" to 10 <


If you power the Raspberry Pi Pico/RP2040 the OLED Display will start to show the distance of the obstacle detected by ultrasonic sensor and if the distance is smaller then 10cm the integrated LED on the Raspberry Pi Pico/RP2040 will be activated. The LED will blink faster if the distance is smaller.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it and open it in Visuino: https://www.visuino.com
