HC-RS04 NewPing Class


sonar non blocking sonar

Just finished writing a small C++ class to work with multiple HC-RS04 sonar transducers with a non-blocking way with the NewPing Library.
In this exact code I connected two sensors, but you can add as many as you like.

To add new sonars, just create a new instance of it adding the echo and trigger pins.

Sonar sonar1(2,3);

Here is an example with some NeoPixels, just for fun:

Cheers!

One comment on “HC-RS04 NewPing Class

  1. Kaustuv February 11, 2019 1:21 am

    Sir, I like your idea very much and I m impressed with your project. So, I just want to make this amazing project but the problem is that you haven’t mentioned the device or the component you are using also there is no information about the connection, please sir help me out with this.
    I’ll be so glad if you’ll help me out.
    Thanks

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.