Extracting data from Arduino

Hi everyone.

I'm receiving date through serial from an Arduino. I'm receiving two values and now I'm trying to separate those two values into differente messages to use them in the dashboard.

I've tried to follow https://nodered.org/docs/writing-functions#multiple-outputs but I couldn't make it work.

This is how I see the data on a debug node.

Any help is apprecited. Thanks

I am confused, you say you are receiving two values, which I assumed you meant two values in one message, but each message only seems to have one value.

Hello mvas,

Why on the arduino code you don't add something before the value of each one of the variables before the println? This will make you an easy way to differentiate each one of the values with a easy node that split to a different output "if contains x"


1 Like

I finally made it work, so I would share what I did to help others.

In Arduino I had to stop using println to differentiate each value as @davidcgu suggested so :

  Serial.println(" ");

Then I used two functions nodes

First Function:
var message1 = {topic: "pot", payload: msg.payload.split(",")[1]};
return [ [ message1] ];

Second Function:
var message2 = {topic: "LM35", payload: msg.payload.split(",")[0]};
return [ [ message2] ];

The outputs of those functions gave the payload I wanted.

That's all.
Thanks for the help!