Bug in API response, Reading multiple Fields with ESP8266 Arduino Library.
1 Comment
Hallo, dasselbe Problem habe ich auch! "Thingspeak libary" = Katastrophe.
Funktioniert aber "httpGET-Abfrage hervorragend.
Ich mache auch "last" alle 15 Minuten und falls es ein neuer Wert geschrieben wurde, bekomme ich immer den neusten Wert in Arduino angezeigt
Serial.println("Reading from Thingspeak"); HTTPClient http;
String url= "http://API.thingspeak.com/channels/Chanelnummer/fields/4/last.json?api_key=apikey=reults=2" http.begin(url); int httpResponseCode = http.GET();
if (httpResponseCode == 200) { String payload = http.getString(); Serial.println(payload);
int field4ValueIndex = payload.indexOf("\"field4\":\"")+10;
String field4Value = payload.substring(field4ValueIndex, payload.indexOf("\"", field4ValueIndex));
} else {
Serial.println("Error Reading from Thingspeak")
unsigned Long timeout = millis; if (millis() - timeout > 60000) { return; }
Es funktioniert auch auf Display, "Display.print" oder Serial, "Serial.print" Ich verwende libary: #include "HTTPClient.h" #include ArdunioJson.h //Vers.5.13
Viel Glück!
Accepted Answer
More Answers (1)
0 votes
Communities
More Answers in the ThingSpeak Community
Categories
Find more on Read Data from Channel in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!