Testing the distance meter
Before testing the distance meter, we will need to wire together the buzzer and the ultrasonic sensor to the SMT32 Blue Pill in the solderless breadboard. The following screenshot illustrates a complete circuit diagram including the STM32, ultrasonic sensor, and buzzer together in the solderless breadboard:
The following screenshot shows how everything should be connected in the actual system:
Now, to complete the connection of the complete social-distancing device, we will need to write a new script combining the Chapter13/buzzer
and Chapter13/ultrasonic
scripts. The new script will be named Chapter13/distance_meter
. Follow these steps:
- We need to declare the constants and variables of both scripts and add a new script to define the safety distance between...