# Serial Input to Function

**URL:** <https://discourse.nodered.org/t/serial-input-to-function/50474>\
**Category:** General\
**Created:** [1 September 2021 03:03 UTC](https://discourse.nodered.org/t/serial-input-to-function/50474 "2021-09-01T03:03:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lowelljt26](https://avatars.discourse-cdn.com/v4/letter/l/65b543/32.png) [@lowelljt26](https://discourse.nodered.org/u/lowelljt26)\
**Post date:** [1 September 2021 03:03 UTC](https://discourse.nodered.org/t/serial-input-to-function/50474/1 "2021-09-01T03:03:02Z")

</div>

Hey Everyone, I have a flow which reads serial input from a balance to a RaspberryPi. The serial flow then parses the information every second into an integer and delivers the weight as msg.payload to a function node in a separate flow to operate a metering pump if the scale weight \< target weight. The data is constantly feeding the debug on deployment of the flow, but I was wondering if the balance weight could be triggered on/off by a UI button, where the scale data doesn't deliver a payload unless the button is selected? New to Node-Red and JavaScript. Any help with this is greatly appreciated.

---

<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:** [1 September 2021 09:55 UTC](https://discourse.nodered.org/t/serial-input-to-function/50474/2 "2021-09-01T09:55:47Z")

</div>

You could try having the ui-button control a [gate node](https://flows.nodered.org/node/node-red-contrib-simple-gate)

---

<div class="post-metadata">

**Author:** ![lowelljt26](https://avatars.discourse-cdn.com/v4/letter/l/65b543/32.png) [@lowelljt26](https://discourse.nodered.org/u/lowelljt26)\
**Post date:** [2 September 2021 01:00 UTC](https://discourse.nodered.org/t/serial-input-to-function/50474/3 "2021-09-02T01:00:22Z")

</div>

That works. Thank you for the help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 September 2021 01:01 UTC](https://discourse.nodered.org/t/serial-input-to-function/50474/4 "2021-09-16T01:01:19Z")

</div>

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