This may seem a little stupid, i apologize if so as i'm new to electronics/arduino.
I have 4, 4-pin ping sensors. I'm running out of available pins on my UNO.
I had a ponder & wondered if it was possible to link all 4 sensor's trig pins to a single digital pin, with the echo pins assigned to their own pin. In my head, on each sensor call (sorry i'm used to programming terms) all 4 sensors would send a pulse, then only the sensor (or echo pin) in question would be read. Is that plausible? each ping sensor is about 20-30 cm separated, but facing internally, in a spiral downwards.
1 Answer 1
I was able to achieve the result using my suggested method in the question. As BrettAM stated, the signals are wasted on the other 3 pins when checking 1. This solution was suitable as a proof of concept
pulseIn
method to get the echo pins durations.pulseIn
will not stop working, but it can only measure one of the sensor's results at a time so the others signals are wasted. It is possible to write something that could measure all the pulses simultaneously, although it is not the easiest thing in the world to do.