commit e2eb2a5ca32405a964d67018b60a74a032089408 Author: Yanis RIGAUDEAU Date: Thu Jul 2 21:37:38 2026 +0200 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..18dc9db --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +credentials.h +.theia + +.DS_Store diff --git a/fan-controller/fan-controller.ino b/fan-controller/fan-controller.ino new file mode 100644 index 0000000..524bfd9 --- /dev/null +++ b/fan-controller/fan-controller.ino @@ -0,0 +1,48 @@ +#include + +#include "credentials.h" + +WiFiServer server(1337); + +void setup() { + Serial.begin(115200); + + Serial.println(); + Serial.println(); + Serial.print("Connecting to "); + Serial.println(SSID); + + WiFi.mode(WIFI_STA); + WiFi.begin(SSID, PASSWORD); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println(""); + Serial.println("WiFi connected"); + Serial.print("IP address: "); + Serial.println(WiFi.localIP()); + + server.begin(); + Serial.println("Server started"); +} + +void loop() { + WiFiClient client = server.available(); + + if (client) { + Serial.println("\n[Client connected]"); + while (client.connected()) { + // read line by line what the client (web browser) is requesting + if (client.available()) { + char line = client.read(); + Serial.print(line); + } + } + + client.stop(); + Serial.println("[Client disconnected]"); + } +}