#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "Wokwi-GUEST";
const char* password = "";
const char* appsScriptUrl = "https://script.google.com/macros/s/AKfycbynZmBqgQYFL3qm5agdcSw4br5QPTMK0v8RNO7TddJA9UFbiWMnusgD8TwGiXd7I5jl/exec"; // URL de la aplicación web
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Conectando a WiFi...");
}
Serial.println("Conectado a WiFi");
}
void loop() {
String value1 = "128361";
String value2 = "AMCN01";
String value3 = "120";
String value4 = "100";
String value5 = "Parcial";
String url = String(appsScriptUrl) + "?value1=" + value1 + "&value2=" + value2 + "&value3=" + value3 + "&value4=" + value4 + "&value5=" + value5;
Serial.println(url);
HTTPClient http;
http.begin(url);
int httpCode = http.POST(url);
if (httpCode > 0) {
Serial.printf("HTTP POST code: %d\n", httpCode);
String payload = http.getString();
Serial.println(payload);
} else {
Serial.printf("HTTP POST failed, error: %s\n", http.errorToString(httpCode).c_str());
}
http.end();
delay(5000); // Espera 1 minuto
}