// Adoora — networked solenoid control // The board hosts its own WiFi access point and serves a Lock/Unlock page. // A phone joins "Adoora_AP", opens 192.168.4.1, and the button hits // /on or /off, which drives the solenoid through the MOSFET on pin D9. #include #include const int CTRL = D9; // -> R1 120ohm -> MOSFET gate -> solenoid WebServer server(80); // The control page (same markup as adoora-control.html), served from flash. const char PAGE[] PROGMEM = R"HTML( Adoora

ADOORA

Locked
)HTML"; void handleRoot() { server.send_P(200, "text/html", PAGE); } void handleOn() { digitalWrite(CTRL, HIGH); server.send(200, "text/plain", "open"); } void handleOff() { digitalWrite(CTRL, LOW); server.send(200, "text/plain", "locked"); } void setup() { pinMode(CTRL, OUTPUT); digitalWrite(CTRL, LOW); Serial.begin(115200); WiFi.softAP("Adoora_AP"); // the board becomes the network Serial.print("Open http://"); Serial.println(WiFi.softAPIP()); // 192.168.4.1 -- the address server.on("/", handleRoot); server.on("/on", handleOn); server.on("/off", handleOff); server.begin(); } void loop() { server.handleClient(); }