Replace hardware timer with software timer

#1

I have an LED that flashes every 1/2 second. I do not want to send anything to a debug unless the LED stays solid for at least 1.5 seconds. Any help would be greatly appreciated.

Thanks,
Mike

#2

I know what you need and something like my node-red-contrib-mytimeout does something similar but I'm set to run on seconds not milliseconds.

Now the questions, what is a flash (light to dark or dark to light - ie normal non-flashing state is either dark (0) or light (1).

Either way using mqtt as my input (just for ease of use). I'd do somthing like this:

[ mqtt LED topic ] ---> [ countdown ] ---> [ mqtt alert topic ]

If LED flashes, timer gets tickled and no output occurs on alert topic.

Internally the flash causes the timer to start counting down to 0 in 1500 ms. If another flash occurs, reset the timer to 1500 ms. If it counts down to 0 then send the message.

Just a note, my node (node-red-contrib-mytimeout) sends an on when the timer is turned on and has a stop and cancel feature. It shouldn't be too hard to modify this to make it only send on timeout. There might be a node that already does this.

#3

This is a light on a machine. When it flashes, it flashes on and then off (1 or 0). If the machine is running, the light is on (1). When the machine is idle, it flashes.

I will take a look at the node that you are suggesting. Thank you!

#4

Use first a switch that filters the value of 1 (as during normal function you said is always at 1) then link it to the "trigger node" standard on the palette, you can set at this moment the msg.payload to "machine fault" for instance and set also after 1,5 sec msg.payload "running" for instance...

This will make that if led stays at 1 you will have running status however is it's blinking with a frequency faster than 1,5 sec then will retrigger the node and will stay at "machine fault".

Regards

#5

David,
I would like to use the nodes that you suggest, but I haven't had any luck getting it to work. Here is a little more clarification.

State 1:
Machine is running : sends msg.payload = 1

State 2:
Machine is stopped: sends msg.payload = 0

State 3:
Machine is waiting for operator: msg.payload alternates between 1 and 0 in 500 millisecond intervals.

I do not want a msg.payload if machine is in State 3.

#6

Seems like the core trigger node would work -- set to this configuration:

image

So the only msgs to get through would be the last one (either a "1" or a "0") once the "flashing" stops...

#7

Works perfect! Thank you