Skip to content

Instantly share code, notes, and snippets.

@suzukiken
Created October 31, 2015 08:48
Show Gist options
  • Save suzukiken/0a432167040107bf4a5c to your computer and use it in GitHub Desktop.
Save suzukiken/0a432167040107bf4a5c to your computer and use it in GitHub Desktop.
ThingShadowEcho.ino additional code.
// print Count and Time
int cntst = delta.indexOf("\"Count\":");
if (cntst != -1) {
cntst += strlen("\"Count\":");
int cnted = delta.indexOf(",");
if (cnted == -1) {
cnted = delta.indexOf("}");
}
String cnt = delta.substring(cntst, cnted);
Serial.println("Count: " + cnt);
}
int timst = delta.indexOf("\"Time\":\"");
if (timst != -1) {
timst += strlen("\"Time\":\"");
int timed = delta.indexOf("\"}");
String tim = delta.substring(timst, timed);
Serial.println("Time: " + tim);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment