Lichtklingel: Unterschied zwischen den Versionen
JoaK (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
{{Head_en}} | {{Head_en}} | ||
Lichtklingel | === Lichtklingel === | ||
Türklingel ist auditiv nicht barrierefrei für gehörlose und hörbehinderte Menschen. <br> | |||
Ebenso können Kopfhörernutzer*innen die Türklingel oftmals verpassen. Daher wurde die Glocke an das Cleanup-Lichtsignal angehängt. Jetzt leuchtet die Leuchtbirne im [[Hauptraum]], [[Whateverlab]] und in der [[Bibliothek]] und schaltet sich nach 10 Sekunden ab. | |||
{{Projekt | {{Projekt | ||
|image=Lichtklingel.jpg | |image=Lichtklingel.jpg | ||
Zeile 12: | Zeile 14: | ||
|hidden=false | |hidden=false | ||
}} | }} | ||
<gallery> | |||
Lichtklingel1.jpg| Löten am Lochrasterplatine | |||
Lichtklingel3.jpg| MH-ET LIVE D1 Mini ESP32 | |||
Lichtklingel2.jpg| Türklingel mit Baugehäuse drangehängt | |||
</gallery> | |||
<pre> | |||
#include <WiFi.h> | |||
#include <HTTPClient.h> | |||
const char* ssid = "Metalab Secure"; | |||
const char* password = "********"; | |||
int alarmo = 0; | |||
void setup() { | |||
Serial.begin(115200); | |||
Serial.println("start"); | |||
pinMode(25,INPUT_PULLUP); | |||
WiFi.begin(ssid, password); | |||
while(WiFi.status() != WL_CONNECTED) { | |||
delay(500); | |||
Serial.print("."); | |||
} | |||
} | |||
void loop() { | |||
if(digitalRead(25)==LOW){ | |||
alarmo++; | |||
Serial.println(alarmo); | |||
if(alarmo > 20 && WiFi.status()== WL_CONNECTED){ | |||
if(WiFi.status() != WL_CONNECTED) { | |||
WiFi.disconnect(); | |||
WiFi.begin(ssid, password); | |||
Serial.println("Connecting"); | |||
while(WiFi.status() != WL_CONNECTED) { | |||
delay(500); | |||
Serial.print("."); | |||
} | |||
Serial.println(""); | |||
Serial.print("Connected to WiFi network with IP Address: "); | |||
Serial.println(WiFi.localIP()); | |||
} | |||
HTTPClient http; | |||
//TURN ON Hauptraum-Alarm | |||
String serverPath = "http://hauptraumalarm/cm?cmnd=Power%20ON"; | |||
http.begin(serverPath.c_str()); | |||
int httpResponseCode = http.GET(); | |||
http.end(); | |||
//TURN ON WEL-Alarm | |||
serverPath = "http://welalarm/cm?cmnd=Power%20ON"; | |||
http.begin(serverPath.c_str()); | |||
httpResponseCode = http.GET(); | |||
http.end(); | |||
//TURN ON Bib-Alarm | |||
serverPath = "http://bibliothekalarm/cm?cmnd=Power%20ON"; | |||
http.begin(serverPath.c_str()); | |||
httpResponseCode = http.GET(); | |||
http.end(); | |||
//Wait 10 seconds | |||
delay(10000); | |||
//TURN OFF Hauptraum-Alarm | |||
serverPath = "http://hauptraumalarm/cm?cmnd=Power%20OFF"; | |||
http.begin(serverPath.c_str()); | |||
httpResponseCode = http.GET(); | |||
http.end(); | |||
//TURN OFF WEL-Alarm | |||
serverPath = "http://welalarm/cm?cmnd=Power%20OFF"; | |||
http.begin(serverPath.c_str()); | |||
httpResponseCode = http.GET(); | |||
http.end(); | |||
//TURN OFF Bib-Alarm | |||
serverPath = "http://bibliothekalarm/cm?cmnd=Power%20OFF"; | |||
http.begin(serverPath.c_str()); | |||
httpResponseCode = http.GET(); | |||
http.end(); | |||
WiFi.disconnect(); | |||
alarmo = 0; | |||
} | |||
} else { | |||
alarmo--; | |||
} | |||
if(alarmo < 0){ | |||
alarmo = 0; | |||
} | |||
} | |||
</pre> |