|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
|||
|
|||
|
Re: HC-SR04 Ultrasonic Distance Sensor wiring and programming
Seems like you would:
VCC: +5VDC Trig : Trigger (INPUT) - DIO<mm> Echo: Echo (OUTPUT) - DIO<nn> GND: GND To use the sensor you would: 1) Reset a Timer to 0 2) Set DIO<mm> to high 3) wait 10us 4) Set DIO<mm> to low 5) See if DIO<nn> is High 6) If high, read Timer, otherwise back to 5 (abort after 1 second) 7) Distance is per the formula Alternative to 5-7 (which also serves as a double check), see how long DIO<nn> is held high. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|