Using a button to trigger an LED Question

Hey guys im learning node-red and made a flow that is supposed to allow me to click a button on pin 0 of my arduino and trigger a function that changes between 1 and 0 for an led on pin 11.

This flow works correctly when i use an inject but if i use arduino In on pin 0 it doesn't detect the press.

Flow im working on uses:
Arduino in on pin0 -> 500ms delay -> function -> arduino out pin 11

my function is:

var count = global.get('count') || 0;

if(count == 1){
if(count == 0)

// set the payload to the level and return
msg.payload = count;
return msg;

How are you connecting your arduino to Node-RED?

Have you checked you are receiving anything using a debug node?

With the arduino connected it wont update it but with inject i get the proper out put, Im using a teensy 3.2 on pin 0 (digital read) and a push down configuration button. my breadboards correct so im a little confused on it

As @ukmoose has asked

How are you connecting your teensy to a computer running Node-RED (and what type of computer - Pi/Win/Mac?)

What node are you using to feed information from your Teensy into Node-RED?

1 Like

Currently directly with Windows using COM5 port with usb direclty to it

And which node are you using in Node-RED?
Attach a debug node to this node.
When you press your button what do you see in the debug node? (cut and paste it here)

Welcome to Node-RED

2 Nov 11:25:29 - [info] Node-RED version: v1.0.2
2 Nov 11:25:29 - [info] Node.js version: v10.16.3
2 Nov 11:25:29 - [info] Windows_NT 10.0.17134 x64 LE
[debug:bbeb59b8.42ed58] 0

if i put it to any pin it doesnt seem to output anything ti debug after the arduino in

Does the arduino node show that it is connected