This library is great, helps me sending JSON data from Arduino to Web. But I also want to send JSON data from web to Arduino to control some of devices.
At the moment I'm using serial interface for communication between Arduino and Node.js script. I managed to send JSON stream to Arduino but I cannot store it to variable that can be parsed using this library.
I tried this method to read each line:
while (Serial.available() > 0)
{
char recieved = Serial.read();
inData += recieved;
// Process message when new line character is recieved
if (recieved == '\n')
{
Serial.print("Arduino Received: ");
Serial.print(inData);
}
inData = ""; // Clear recieved buffer
}
}
But this example doesn't work for reading line of JSON data.
Any idea why?
This library is great, helps me sending JSON data from Arduino to Web. But I also want to send JSON data from web to Arduino to control some of devices.
At the moment I'm using serial interface for communication between Arduino and Node.js script. I managed to send JSON stream to Arduino but I cannot store it to variable that can be parsed using this library.
I tried this method to read each line:
But this example doesn't work for reading line of JSON data.
Any idea why?