turn on two leds with hc-sr04

how can I turn on 2 LEDs with a hc-sr04 sensor in the ide. the truth is I don’t have an idea of ​​how to do this problem as easy as it will be for some

This is a XOD forum, so you probably won’t get much help programming in IDE here.

Before you can even start on a program, you need to know EXACTLY what you want it to do. “Turning on 2 LEDs with a range sensor” is NOT an exact description. Do you just want to light both LEDs when the sensor is active? Do you want one LED turned on when something is within 10cm and both turned on when something is within 5cm? EXACTLY what you want to do will determine how it should be done…

Most likely, you will want to use the built-in XOD node xod-dev/hc-sr04/hc-sr04-range-meter to read a distance from the sensor, then compare the output to determine actions. One gotcha that you will run into with the range-finder is that it needs time to recover from each ping, so you should NOT leave the sensor node in loop mode; there should be some trigger to take a reading only when needed (which could be a point in your program, or could just be every couple seconds using a clock node).

Without more information about what you are trying to do, it is impossible to provide any more help, but there are several example nodes in xod-dev/hc-sr04 that will show how the sensor can be used.