Hello
I'd like to use 4 HC-SR04 sensors on my bot using the ultrasonic library. I have two questions regarding it:
-
Timing:
When i use a sensor, it triggers it by stting the trigger pin to high and then waits for the sensor to respond. depending on how long this waittime is, the distance is calculated. now this means, that the execution speed is significantly slowed down by this waiting times - so my question is, whether it's somehow possible to use the HC-SR04 with interrupts instead. and also, whether it's possible to trigger all 4 sensors at once and still get the correct results back, instead of triggering one, waiting for the result, then triggering the next one and so on. -
Pins:
For each sensor i need a pin for triggering and one to listen to the response. That's 8 pins for the 4 sensors. I was wondering how i can safe on pins. I think it's not a good idea to hook all triggers to a single pin, but would it be possible to connect all sensor responses to a single arduino input pin? if i trigger the sensors after each other it means i know from which sensor the signal is comming from. or could the other sensors be disturbed by the signal created by the currently used sensor?