# Live gpio timer duration to lcd

**URL:** https://discourse.nodered.org/t/live-gpio-timer-duration-to-lcd/7075
**Category:** General
**Created:** [21 January 2019 05:21 UTC](https://discourse.nodered.org/t/live-gpio-timer-duration-to-lcd/7075 "2019-01-21T05:21:39Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![undung](https://avatars.discourse-cdn.com/v4/letter/u/53a042/32.png) [@undung](https://discourse.nodered.org/u/undung)
#### Post date: [21 January 2019 05:21 UTC](https://discourse.nodered.org/t/live-gpio-timer-duration-to-lcd/7075/1 "2019-01-21T05:21:39Z")

</div>

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

```auto
[{"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"]]}]

```

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [21 January 2019 07:44 UTC](https://discourse.nodered.org/t/live-gpio-timer-duration-to-lcd/7075/2 "2019-01-21T07:44:40Z")

</div>

Unfortunately your flow isn't currently importable.Please read the following post [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506?u=ukmoose)and then edit the above message.

---

<div class="post-metadata">

### Author: ![undung](https://avatars.discourse-cdn.com/v4/letter/u/53a042/32.png) [@undung](https://discourse.nodered.org/u/undung)
#### Post date: [22 January 2019 01:37 UTC](https://discourse.nodered.org/t/live-gpio-timer-duration-to-lcd/7075/3 "2019-01-22T01:37:34Z")

</div>

ok i have re write again

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [22 January 2019 08:44 UTC](https://discourse.nodered.org/t/live-gpio-timer-duration-to-lcd/7075/4 "2019-01-22T08:44:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [22 January 2019 09:11 UTC](https://discourse.nodered.org/t/live-gpio-timer-duration-to-lcd/7075/5 "2019-01-22T09:11:52Z")

</div>

> [@zenofmud](#):
>
> For one thing, your switch node only tests to see if msg.payload is 0 - so anytime it is a 1 it is ignored.

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.
