bookmark_borderHC-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!