#include <ArduinoJson.h>
#include <ArduinoJson.h>
#include <HTTPClient.h>
const char* ssid ="Wokwi-GUEST";
const char* password="";
HTTPClient client;
void setup(){
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid,password);
//wait for connection
while(WiFi.status()!= WL_CONNECTED){
delay(500);
}
client.begin ("https://api.thingspeak.com/update?api_key=A9CQ81QZRW35OBMK&field1=12");
int httpResponseCode=client.GET();
if(httpResponseCode>0){
String payload = client.getString();
Serial.println(payload);
DynamicJsonDocument doc(256);
deserializeJson(doc, payload);
Serial.print("Led =");
Serial.print(doc["Led1"].as<String>());
}
}
void loop(){
}