..#include #include const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; String mirrorIP = "http://YOUR_PI_IP:8080/irwake"; int irPin = A0; int threshold = 1200; unsigned long lastTrigger = 0; unsigned long keepOn = 20UL * 60UL * 1000UL; bool triggered = false; void setup() { Serial.begin(115200); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(300); } } void sendRequest(String action) { HTTPClient http; http.begin(mirrorIP + "?action=" + action); http.GET(); http.end(); } void loop() { int irValue = analogRead(irPin); if (irValue < threshold) { lastTrigger = millis(); if (!triggered) { sendRequest("on"); triggered = true; } } if (triggered && (millis() - lastTrigger > keepOn)) { sendRequest("off"); triggered = false; } delay(100); }