#include <WiFi.h>
#include <WiFiClient.h>
#include "ThingSpeak.h"
#define LDR_pin 32
const char* WIFI_Name = "Wokwi-GUEST";
const char* WIFI_PASSWORD = "";
const int myChannelNumber = 3370779;
const char* myApiKey = "BHE9PHCBUP0021V3";
const char* server = "api.thingspeak.com";
WiFiClient client;
void setup() {
pinMode (LDR_pin, INPUT);
WiFi.begin(WIFI_NAME, WIFI_PASSWORD);
ThingSpeak.begin(client);
Serial.begin (115200);
}
void loop() {
int ldr = analogRead(LDR_pin);
Serial.println(ldr);
ThingSpeak.setField(1,ldr);
ThingSpeak.writeFields(mychannelNumber,myApiKey);
}