Step 1: Build the circuit. The circuit is relatively simple.
Ultrasonic sensor:
GND to GND
VCC to 5V
ECHO to D2
TRIG to D3
Buzzer:
+ to D9
- to GND
LED
+ to D13
- To GND
Step 2: Upload the Code
Thank you to abdularbi17 for part of the code ( https://create.arduino.cc/projecthub/abdularbi17/ultrasonic-sensor-hc-sr04-with-arduino-tutorial-327ff6?ref=user&ref_id=1134675&offset=0 )
Step 3: Put it in a box and attach it to the doorframe deppending on the width you might need to edit the if statment.
Thank you!
Comments