At this project I am inspired of the idea of car parking sensor or any other proximity alarm system which detects nearby objects and fires an alarm of light & sound.
Software used:
TINKERCAD to design & simulate circuit.
Arduino IDE to upload the code to the Arduino
Components:
Arduino Uno
Ultrasonic sensor
LED
Buzzer
220 ohm resistance
Jumpers
Breadboard
Input: Ultrasonic sensor
Output: LED & Buzzer
In this circuit the ultrasonic is the input (Trigger on Pin no. 11 , Echo on pin no. 10) , as it controls both buzzer (Pin no. 9) and LED (Pin no. 8).
When the sensor detects and object at a distance equal to or less than 35 cm, it orders the two output components to work.
This code detects any body in the range of 35 cm to trigger the alarm (LED+Buzzer)
It depends on IF condition: if the distance of the body detected is less than or equal 35 cm, the signal on both buzzer and LED is high for one second, then low for one second making them blinking like alarm.
If the distance detected by the ultrasonic is greater than 35 cm, then the signal on LED & buzzer is low, so they don't work.
Code is downloaded from Tinker Cad by clicking on download
After downloading the code, I opened the .ino file in Arduino IDE and the clicked on upload after making sure that selected port is Arduino board.
I made a mistake in a connection for the ground of the LED, after revising the circuit I figured it out and corrected it, and everything went fine after that.
Controlling 2 objects by 2 different input was a very WOW thing like we did in waving machine .
The minion was very cute and fun.
minion waving machine