A basic application of HC-SR04(Ultrasonic sensor)
->Maps distance
->Decides suitable range
->Opens the lid of the Bin
1.Ultrasonic.h
2.HC-SR04.h
(Install these libraries from this Repository)
You can either use the already pre-installed libraries of Arduino or you can find the libraries by searching them on Library Manager Incase that didn't work I'm also providing the library files which you can isntall by following the below steps:
- After downloading the repository→Extract the library zip files
- Go to Sketch→Include library→Add .ZIP Library
- Select the the library.zip files
Here's a small demonstration below: