JsonObject obj1 = doc1.as<JsonObject>();
String city = obj1["city"];
String temp1 = obj1["temp1"];
String temp2 = obj1["temp2"];
String weather = obj1["weather"];
String cityInfo ="Address:"+ city;
String tempInfo =" Temperature: " + temp1 + "~" + temp2;
String cityWeatherinfo = " Weather: " + weather;
Serial.println("The weather conditions obtained are as follows: ");
printLocalTime();
Serial.print(cityInfo);
Serial.print(tempInfo);
Serial.println(cityWeatherinfo);
}else{
Serial.println("GET ERR");
}
http.end();
}
void setup() {
Serial.begin(115200);
Serial.printf("Connecting to %s",ssid);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED){
delay(500);
Serial.print(".");
}
Serial.println(" CONNECTED");
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
// printLocalWeather();
}
void loop() {
if(WiFi.status() == WL_CONNECTED){
printLocalWeather();
}else{
S
i l
i tl ("WiFi
Di
t")
Need help?
Do you have a question about the FireBeetle ESP32-E and is the answer not in the manual?