HC-SR04 and LED bar

Just trying to figure out making a HC-sr04 control a led bar, 8 led’s. I’ve got a clock set at .25, going to the sonic sensor, then I get lost. Is the sonic sensor outputting what? 0,1, or analog, or data? Is there a way to use serial data to see the output?

I do have the LED ports set to the connected pins 2,3,4,5,6, 11,12,13.


The HC-SR04 on its own outputs a hardware digital pulse when it hears an ultrasonic 40 KHz sound. It’s a consumer responsibility to generate a sound burst, run a “stopwatch”, measure the time until echo, and convert sound roundtrip time to distance units.

The xod/common-hardware/hc-sr04-ultrasonic-range does it for you. You get the distance in meters and don’t bother about timings, echo catching, etc.

Link the Dm output value to eight less nodes to build a multi-channel comparator. Send the output of each less to a led and you’ll likely achieve what you are trying to do.