1

I want to connect multiple Ultrasonic sensors to my Arduino board. For that, I need multiple pulseIn() functions to work at the same time. How can I do that?

asked Oct 1, 2016 at 17:27

1 Answer 1

3

You can't. pulseIn() is a blocking function that waits for a pulse to arrive before returning.

Instead you will either have to use interrupts or (where available) Input Capture peripherals.

However, using multiple ultrasonic sensors at the same may not make sense. Unless you take great care with your physical design you will get interference between the two. Echoes from one bouncing around will trigger the other. For this reason it is normal to not trigger both at once, but to use them sequentially, in which case pulseIn() is still perfectly fine to use.

answered Oct 1, 2016 at 17:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.