I was controlling LED from server.
Firstly I was working with www.000webhost.com, it worked fine and I didn't get any error. I controlled LED from remote server. But only the issue was less speed.
So I purchased new server from www.hostinger.com to overcome less speed. But there I m getting parseobject failed error in arduino code.
The same arduino code worked for free server (www.000webhost.com) and its not working for paid server (www.hostinger.com), even i tried with godaddy, there also i m getting the same error.
Any one please in this issue.
String line = client.readStringUntil('\r');
//Serial.print(line);
// we’ll parse the HTML body here
if (section=="header") { // headers..
if (line=="\n") { // skips the empty space at the beginning
section="json";
}
}
else if (section=="json") { // print the good stuff
section="ignore";
String result = line.substring(1);
// Parse JSON
int size = result.length() + 1;
char json;
result.toCharArray(json, size);
StaticJsonBuffer<300> jsonBuffer;
JsonObject& json_parsed = jsonBuffer.parseObject(json);
if (!json_parsed.success())
** {**
** Serial.println("parseObject() failed"); // here my code stucked**
** return;**
** }**
String led = json_parsed["led"][0]["status"];
if(count == 1){
if(led == "on"){
digitalWrite(D1, 1);
delay(100);
Serial.println("D1 is On..!");
}
else if(led == "off"){
digitalWrite(D1, 0);
delay(100);
Serial.println("D1 is Off..!");
}
count = 0;
}
}