#include #include const char* ssid = ""; //put my own wifi ssid here const char* password = ""; //wifi password here // ThingSpeak info const char* server = "https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=0"; //got API key from thingspeak.mathworks.com and replaced xxxxxxxxxxxxxxxx with it const char* apiKey = "xxxxxxxxxxxxxxxx"; //got API key from thingspeak.mathworks.com and replaced xxxxxxxxxxxxxxxx with it void setup() { Serial.begin(115200); WiFi.begin(ssid, password); Serial.print("Connecting to WiFi"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("\nConnected!"); } void loop() { int Scores = random(0, 100); // to be replaced with the real scores if (WiFi.status() == WL_CONNECTED) { HTTPClient http; String url = String(server) + "?api_key=" + apiKey + "&field1=" + String(Scores); http.begin(url); int httpCode = http.GET(); if (httpCode > 0) { Serial.println("Data sent!"); } else { Serial.println("Error sending data"); } http.end(); } delay(60000); // wait 60 seconds }