# Extracting data from Arduino

**URL:** <https://discourse.nodered.org/t/extracting-data-from-arduino/1870>\
**Category:** General\
**Created:** [27 July 2018 17:03 UTC](https://discourse.nodered.org/t/extracting-data-from-arduino/1870 "2018-07-27T17:03:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mvas](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@mvas](https://discourse.nodered.org/u/mvas)\
**Post date:** [27 July 2018 17:03 UTC](https://discourse.nodered.org/t/extracting-data-from-arduino/1870/1 "2018-07-27T17:03:08Z")

</div>

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](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.

 ![node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/945ab9216ef098319d8026d6fa44dd3811f6daa2.jpg)

Any help is apprecited. Thanks

---

<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:** [27 July 2018 17:17 UTC](https://discourse.nodered.org/t/extracting-data-from-arduino/1870/2 "2018-07-27T17:17:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [27 July 2018 17:25 UTC](https://discourse.nodered.org/t/extracting-data-from-arduino/1870/3 "2018-07-27T17:25:20Z")

</div>

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"

Regards

---

<div class="post-metadata">

**Author:** ![mvas](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@mvas](https://discourse.nodered.org/u/mvas)\
**Post date:** [27 July 2018 17:49 UTC](https://discourse.nodered.org/t/extracting-data-from-arduino/1870/4 "2018-07-27T17:49:41Z")

</div>

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.print(tempC);
  Serial.print(",");
  Serial.print(volt);
  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!
