In my recent project, I'm working with Arduino and JSON. Now, I get data from JSON and I can able to receive in Arduino side.
Below one is my Arduino code:
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
String response = "";
bool begin = false;
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
}
void loop()
{
while(Serial.available() || !begin)
{
char in = Serial.read();
if (in == '{')
{
begin = true;
}
if(begin) response += (in);
if(in == '}')
{
break;
}
delay(1);
}
lcd.setCursor(0, 0);
lcd.print(response);
}
Output :
{"TPS":"0.40","MAP":"1.05","LOAD":"14"}
Now, I want to split data means store 0.40
in one variable, 1.05
in another variable and 14
in another variable. I don't know how to split this.