#include <ESP8266WiFi.h>
#include <ThingSpeak.h>
const char* ssid = "Wokwi-GUEST";
const char* password = ""; // Leave this completely empty
unsigned long myChannelNumber = 3388175;
const char* myWriteAPIKey = "LOOM5HJZG70GR9P0";
WiFiClient client;
void setup() {
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) delay(500);
ThingSpeak.begin(client);
}
void loop() {
// Read analog value, convert to voltage, then to Celsius
float temp = analogRead(A0) * (3.3 / 1023.0) * 100.0;
// Upload directly to Field 1
ThingSpeak.setField(1, temp);
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
delay(15000); // 15-second mandatory delay for ThingSpeak
}
Loading
esp32-c3-rust-1
esp32-c3-rust-1