hc-sr04 program

Hello, I have to use hc-SR04 sensors to detect a obstcle crosswalks, I would like to know the connection of its sensors on arduino uno or mega.

I also wanted to know the program so that when the obstacle is passed, the sensor signal to the arduino.

Thank you.

You have some information, including the connections on the uno, in the link below: http://vinduino.blogspot.pt/2013/07/hc-sr04-ultrasonic-sensor.html

Found it using Google, you'll be able to find a lot more information and faster by searching the forums (top right corner) also :)

Thank for your answer I wish use 8 sensors, i need to use 16 input/output? or i can put Echo pin on a same input? Thanks

I've never actually used this type of sensor, but I'm guessing it depends.

To read you'll need to use 8 pins, so you can identify which particular sensor you're reading. To trigger a signal I'm guessing you could use only one digital pin, but only if want to trigger them all at same time. If not, then you'll need to assign 8 different pins so you know which sensor you're targeting.

Lacrim: Thank for your answer I wish use 8 sensors, i need to use 16 input/output? or i can put Echo pin on a same input? Thanks

The NewPing library supports both using a single pin per sensor as well as includes example sketches that ping many sensors. It's custom-built to do exactly what you're looking for. The support forum can also be found here.

Tim

I need to make a program when the sensor detects the passage of an object, it communicates to the arduino. :)

Lacrim:
I need to make a program when the sensor detects the passage of an object, it communicates to the arduino. :slight_smile:

The NewPing library would work great for this.

Tim