#include <WiFi.h>
#include <HTTPClient.h>
#include <Wire.h>
/********************************************************************************/
//Things to change\ \
const char* ssid = "Wokwi-GUEST"; // change SSID
const char* password = ""; // change password
String GOOGLE_SCRIPT_ID = "AKfycbwiVWS6qx_iLStUexjCd4QBL2tey1nF3zbasZtbQZglKhZUYkaDLkydOCwS2pnfVA4f";
const int sendInterval = 5000;
void setup() {
Serial.begin(115200);
delay(10);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.println("Started");
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Ready to go");
//testdrawstyles();
}
void loop() {
spreadsheet_comm();
delay(sendInterval);
}
void spreadsheet_comm(void) {
HTTPClient http;
String url="https://script.google.com/macros/s/"+GOOGLE_SCRIPT_ID+"/exec?read";
// Serial.print(url);
Serial.print("Making a request");
http.begin(url.c_str()); //Specify the URL and certificate
http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
int httpCode = http.GET();
String payload;
if (httpCode > 0) { //Check for the returning code
payload = http.getString();
Serial.println(httpCode);
Serial.println(payload);
testdrawstyles(payload);
}
else {
Serial.println("Error on HTTP request");
}
http.end();
}
Loading
esp32-devkit-c-v4
esp32-devkit-c-v4