Hello, I have a arduino sending 2 sensor values as a string (with a space inbetween) to a raspberry pi running node-red. I now want to write a script to split the sensor values, turn them back into integers and then send them to 2 charts. With my current code (http://pastebin.com/zKdBL1jy) it doesnt do much.. when i connect a debug node to one of the 2 outputs of the function node (wich contains my code) it just gives me the result "(undefined)". Could anyone help?
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/5a2d6b4a-90ba-4fea-b2ae-9e29beda5df7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CAF%3DvhqfBz%2BM%2BOsmd7_vDQR5wx9a5H5AFsfdB7HnDR5ogrcU4PQ%40mail.gmail.com.
Hi Finn,a Function node should return msg objects, not just raw values:var output = msg.payload.split(" ");var temp = parseInt(output[0]);var heart = parseInt(output[1]);var msg1 = {payload:temp};var msg2 = {payload:heart}return [msg1,msg2];Regards,Nick
On 28 November 2016 at 12:14, Finn Janssens <finnjan...@gmail.com> wrote:
Hello, I have a arduino sending 2 sensor values as a string (with a space inbetween) to a raspberry pi running node-red. I now want to write a script to split the sensor values, turn them back into integers and then send them to 2 charts. With my current code (http://pastebin.com/zKdBL1jy) it doesnt do much.. when i connect a debug node to one of the 2 outputs of the function node (wich contains my code) it just gives me the result "(undefined)". Could anyone help?
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
Hi Finn,a Function node should return msg objects, not just raw values:var output = msg.payload.split(" ");var temp = parseInt(output[0]);var heart = parseInt(output[1]);var msg1 = {payload:temp};var msg2 = {payload:heart}return [msg1,msg2];Regards,Nick
On 28 November 2016 at 12:14, Finn Janssens <finnjan...@gmail.com> wrote:
Hello, I have a arduino sending 2 sensor values as a string (with a space inbetween) to a raspberry pi running node-red. I now want to write a script to split the sensor values, turn them back into integers and then send them to 2 charts. With my current code (http://pastebin.com/zKdBL1jy) it doesnt do much.. when i connect a debug node to one of the 2 outputs of the function node (wich contains my code) it just gives me the result "(undefined)". Could anyone help?
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/2601e014-84eb-43b1-93c5-ad86e7a7ed96%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/150c909d-572f-4ef4-825b-b63b22c48188%40googlegroups.com.
hey sir, I think I figure it out how to do this
var test = msg.payload.substr(3, 2);
msg.payload = test;
return msg;--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/f066f839-7783-4e76-a287-1f0d59d91ea2%40googlegroups.com.