Hi All, huge noob here and i need help. im working towards being able to cast up to 20 voltage readings from an arduino serial print to node red, but want to show them just as separate lines. however i can't seem to get it to work just on a test basis of experimenting.
for my learning purposes i just want to serial.print 2 line statements that i've separated with a colon and 'newlined' with "\n"
tried various guides where they use function but it doesn't do anything for me. both my statements just appear as 1 message line.
here's the e.g. serial print structure (ignore the LED thing):
void loop() {
digitalWrite(led, HIGH);
led_on = digitalRead(led);
if(led_on == HIGH)
{
Serial.print("3 Second LED");
Serial.print(",");
Serial.print("test");
Serial.print("\n");
}
delay (3000);
in node-red i've done a function that takes the serial in and splits it to 2 messages, the details of the function are:
var outputMsgs = [];
var values = msg.payload.trim().split(",");
for(var v in values){
outputMsgs.push({payload:values[v]});
}
return msg;
however it is just showing in message 1: "3 second LED:test"
any help is greatly appreciated.