If Function ((with two Inputs))?

Is there an if function that takes and compares a value of a slider and a lux sensor.

This means that if the lux value is greater than the value of the slider, a value of 1 should be sent

There are no nodes in Node-RED with two separate inputs, but you can do compare two values where they are in separate messages; take a look at this example in the cookbook
https://cookbook.nodered.org/basic/route-on-context

Context values can also be used in a function node, see: https://nodered.org/docs/user-guide/writing-functions
which would allow you to do it in an if statement within a function node

1 Like

You then sent me a private message (copied here so that others can also learn if they find this post)

Hello, I do not understand the two inputs, could you rewrite your example that fits my program. I get a lux value (0-65000) and a value of a slider, and if the lux value is higher than the slider value, a signal should be sent to a GPIO pin.

Have one flow that saves the slider value to a context value (eg global.sliderLux)
In your lux flow have a switch node configured (eg msg.payload is > global.sliderLux )
This will only pass the message on if your lux value ( msg.payload) is greater than your slider value

1 Like