HC-SR04 and led project
HC-SR04 ultrasonic range finder is used to trigger the leds to turn on and off depending on the position of the object in front of the sensor.
There are ten led connected to arduino digital pins 2-11 respectively.The ultrasonic range finder has 4 connections: VCC, Trig, Echo and GND.VCC goes to 5V on your arduino,GND to arduino's ground and finnaly,Trig pin is connected to digital pin 12 while Echo is connected to digital pin 13. Depending on the position of the object in front of the sensor,the leds will do their loop to on and back to off gradually faster as the object approaches the sensor.When the object gets too close(less then 5 centimeters)the leds will start blinking instead and if it gets any closer,they will blink even faster!
Created on August 20, 2013, 15:31