Sensor is like this:
HC-SR04
Leftmost pin is 5VDC
Second pin is Trig(ger)
Third is Echo
Last one is GND
Usage is simple: Set trig high and echo will set itself high. Get the time between (microseconds) by Arduino's pulseIn() function.
Wiring Details
Connect power pins 5VDC and GND as usual.
Connect trig to 7 as output
Connect echo to 8 as input
distance = duration/58.2 (centimeters - max distance is 200)
No comments:
Post a Comment