Live gpio timer duration to lcd

#1

need help
I want to make timer that calculate and view duration on my gpio input when my gpio true/false

there is my simple flow
on this flow i just cant see the result how long my gpio true/false

pls help me

[{"id":"f8c4503.1001eb","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"f929958f.480c38","type":"rpi-gpio in","z":"f8c4503.1001eb","name":"","pin":"38","intype":"tri","debounce":"25","read":false,"x":80,"y":80,"wires":[["aa4d84e7.933288"]]},{"id":"1a0612a0.2d44dd","type":"interval-length","z":"f8c4503.1001eb","format":"human","bytopic":false,"minimum":"","maximum":"","window":"","timeout":true,"msgTimeout":"","minimumunit":"msecs","maximumunit":"msecs","windowunit":"msecs","msgTimeoutUnit":"msecs","reset":false,"startup":true,"msgField":"payload","timestampField":"timestamp","repeatTimeout":true,"name":"","x":440,"y":200,"wires":[["c637df89.07453","46328acb.6a70a4"],[]]},{"id":"c637df89.07453","type":"debug","z":"f8c4503.1001eb","name":"debug2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":640,"y":200,"wires":[]},{"id":"e6b8e0c1.2174","type":"rpi-lcd","z":"f8c4503.1001eb","name":"lcd 16x2","pins":"37,35,33,31,29,32","x":600,"y":320,"wires":[]},{"id":"46328acb.6a70a4","type":"function","z":"f8c4503.1001eb","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":320,"wires":[["e6b8e0c1.2174"]]},{"id":"aa4d84e7.933288","type":"switch","z":"f8c4503.1001eb","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":240,"y":180,"wires":[["1a0612a0.2d44dd"]]}]
#2

Unfortunately your flow isn't currently importable.Please read the following post How to share code or flow json and then edit the above message.

#3

ok i have re write again

#4

For one thing, your switch node only tests to see if msg.payload is 0 - so anytime it is a 1 it is ignored.

also anytime you are using a node that is not one of the standard nodes, you should provide the name like I'm using node-red-contrib-xyznode that will make it easier for others to help you.

#5

Possibly even more significant is the fact that you are testing for string "0" whereas I imagine the value from the pin is numeric 1 or 0. I think your test will never pass. A useful technique for debugging is to use debug nodes. A debug node on the GPIO node will show whether that is triggering and another on the output of the switch will show whether you are getting messages from it.

1 Like