Timer after rising edge

Hi,
I'm using Node-red to control arduino using Firmata!
I have an input (PushButton) that it will change to "TRUE" many times,
I want a simple node that will remember this value on the rising edge" during 3s and then wait for the next "TRUE"

RisingEdgeTimer

"

Many Thanks

[{"id":"cb1b3c7a.7d4548","type":"arduino in","z":"16a6f52b.8b44ab","name":"Push Button","pin":"30","state":"INPUT","arduino":"2e1473db.345ef4","x":130,"y":230,"wires":[["335f8a8b.0e1486"]]},{"id":"5eb8f23b.a93ffc","type":"arduino out","z":"16a6f52b.8b44ab","name":"LED","pin":"31","state":"","arduino":"2e1473db.345ef4","x":520,"y":230,"wires":[]},{"id":"335f8a8b.0e1486","type":"function","z":"16a6f52b.8b44ab","name":"Rising Edge timer","func":"\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":230,"wires":[["5eb8f23b.a93ffc"]]},{"id":"2e1473db.345ef4","type":"arduino-board","z":"","device":"COM4"}]

The red triangle on the LED node indicates a problem with the configuration with that node.

There's also no content in the function node :slight_smile:

A simple trigger node should do what you want

1 Like

Corrected, Thank you!

it's true, in deed It is my question.. I have no idea how to do so

normally I want something like this:

if (INPUT passes from 0 to1) then (OUTPUT=1) wait 3s and redo the same thing...

I tried with the trigger but I saw that it triggered in both the rising and the falling edge :frowning:

To cure that - put a switch in front of it to only pass thru the rising edges

using just a trigger I had this results

jpg

Thnks, I'll try the switch and I'll back

You forgot to enable "extend delay if new message arrives"

[{"id":"11dc9f7b.c1e209","type":"inject","z":"adeab68c.067be8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":600,"y":600,"wires":[["908c32ce.d43ba"]]},{"id":"cc7c5ce1.485ef","type":"debug","z":"adeab68c.067be8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":890,"y":600,"wires":[]},{"id":"908c32ce.d43ba","type":"trigger","z":"adeab68c.067be8","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"3","extend":true,"units":"s","reset":"","bytopic":"all","name":"","x":740,"y":600,"wires":[["cc7c5ce1.485ef"]]}]

The above solve this section

to solve it all it use a rate limiter

[{"id":"11dc9f7b.c1e209","type":"inject","z":"adeab68c.067be8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":600,"y":600,"wires":[["3b25ee70.1b299a"]]},{"id":"cc7c5ce1.485ef","type":"debug","z":"adeab68c.067be8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1110,"y":600,"wires":[]},{"id":"908c32ce.d43ba","type":"trigger","z":"adeab68c.067be8","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"3","extend":true,"units":"s","reset":"","bytopic":"all","name":"","x":940,"y":600,"wires":[["cc7c5ce1.485ef"]]},{"id":"3b25ee70.1b299a","type":"delay","z":"adeab68c.067be8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":780,"y":600,"wires":[["908c32ce.d43ba"]]}]

now if it just so happens that at exactly 3seconds it gets a new trigger you will get a 0 for a millisecond. Close enough.

The OP didn't want it extending if new pulse arrives :slight_smile:

2 Likes

I cought myself a min before you were able to post.

my solution of.

rl

should work

[{"id":"11dc9f7b.c1e209","type":"inject","z":"adeab68c.067be8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":600,"y":600,"wires":[["3b25ee70.1b299a"]]},{"id":"cc7c5ce1.485ef","type":"debug","z":"adeab68c.067be8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1110,"y":600,"wires":[]},{"id":"908c32ce.d43ba","type":"trigger","z":"adeab68c.067be8","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"3","extend":true,"units":"s","reset":"","bytopic":"all","name":"","x":940,"y":600,"wires":[["cc7c5ce1.485ef"]]},{"id":"3b25ee70.1b299a","type":"delay","z":"adeab68c.067be8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":780,"y":600,"wires":[["908c32ce.d43ba"]]}]
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.