Skip to content

Commit

Permalink
Merge pull request #4 from theonlytruth/master
Browse files Browse the repository at this point in the history
Compatibility to ArduinoJson 6
  • Loading branch information
alexstocker authored Mar 5, 2019
2 parents 9ad8965 + e005e1a commit b003feb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sensordata.ino
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void setup(void){
void loop(void){
server.handleClient();
if(WiFi.status() == WL_CONNECTED) {
DynamicJsonBuffer jsonBuffer;
DynamicJsonDocument root(1024);

getDateFromNtp();

Expand All @@ -138,14 +138,13 @@ void loop(void){
http.setAuthorization(username,token);
http.addHeader("Content-Type", "application/json");

JsonObject& root = jsonBuffer.createObject();
root["deviceId"] = "0100110-001100110-1101";
root["temperature"] = rTemp;
root["humidity"] = rHum;
root["date"] = "20"+dateTime;

String jsonStr;
root.printTo(jsonStr);
serializeJson(root, jsonStr);
int httpCode = http.POST(jsonStr);

http.end();
Expand All @@ -172,4 +171,4 @@ void loop(void){
delay(5000);
}

}
}

0 comments on commit b003feb

Please sign in to comment.