projekte:homecomfort
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung | ||
projekte:homecomfort [2021/01/22 16:44] – mancas | projekte:homecomfort [2021/01/22 17:02] (aktuell) – mancas | ||
---|---|---|---|
Zeile 8: | Zeile 8: | ||
# Bilddateiname relativ zum Ordner projekte: | # Bilddateiname relativ zum Ordner projekte: | ||
# Wenn (noch) kein Bild vorhanden, bitte none.png lassen | # Wenn (noch) kein Bild vorhanden, bitte none.png lassen | ||
- | imgname_img90 | + | imgname_img90 |
# Links zu Seiten der Mitglieder, die am Projekt beteiligt sind, also intern: | # Links zu Seiten der Mitglieder, die am Projekt beteiligt sind, also intern: | ||
Zeile 15: | Zeile 16: | ||
# Start- und Enddatum im Format JJJJ-MM-TT | # Start- und Enddatum im Format JJJJ-MM-TT | ||
start_dt | start_dt | ||
- | end_dt | + | end_dt |
+ | |||
+ | # Kurzbeschreibung | ||
+ | shortdesc | ||
# Aktueller Status des Projekts, z.B. fertig, in Arbeit, eingestellt, | # Aktueller Status des Projekts, z.B. fertig, in Arbeit, eingestellt, | ||
- | status_ | + | status_ |
---- | ---- | ||
- | Marco hatte diese Uhr nach einer Idee von bastelgarage.ch Donnerstags zu unserem Linux Vereinstreffen mitgebracht. | + | https://22x22.de/posts/led-wanduhr/ |
- | + | ||
- | Das machte Lust dieses Projekt nachzubauen, | + | |
- | + | ||
- | Code schreiben für den ESP8266 | + | |
- | Ansteuerung einer 8x8-LED Anzeige | + | |
- | Text rollt über die Anzeige | + | |
- | Einwählen ins WLAN | + | |
- | Uhrzeit wird vom Zeitserver abgeholt | + | |
- | Wetter kommt von openweathermap.org | + | |
- | Variablen für den Programmcode werden aus einem Json-File aufbereitet | + | |
- | Gut zum Lernen und ausbaufähig zum kreativen Umsetzen mit eigenen Ergänzungen im Code. | + | |
- | + | ||
- | LED-Uhr-Orig | + | |
- | + | ||
- | Macht sich gut in einem schönen Gehäuse! | + | |
- | LED-Uhr-Zeit | + | |
- | + | ||
- | LED-Uhr-Innen | + | |
- | + | ||
- | So wird angepasst | + | |
- | Die Wetteranzeige hatte bei mir leider nicht funktionniert. Daher wurde das Script auf die Library ESP8266HTTP umgestellt. | + | |
- | + | ||
- | // Modifiziertes Script von https:// | + | |
- | // replaces getWeatherData() | + | |
- | + | ||
- | // added by mancas | + | |
- | // #include < | + | |
- | // #include < | + | |
- | + | ||
- | + | ||
- | void getMetarData () { | + | |
- | String line; | + | |
- | + | ||
- | if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status | + | |
- | + | ||
- | HTTPClient http; //Declare an object of class HTTPClient | + | |
- | + | ||
- | http.begin(" | + | |
- | + | ||
- | int httpCode = http.GET(); | + | |
- | Serial.print(" | + | |
- | Serial.println(httpCode); | + | |
- | + | ||
- | if (httpCode > 0) { //Check the returning code | + | |
- | + | ||
- | String payload = http.getString(); | + | |
- | + | ||
- | Serial.print(" | + | |
- | Serial.println(payload); | + | |
- | + | ||
- | + | ||
- | line += payload; // to let the rest of the script untouched | + | |
- | Serial.println(line); | + | |
- | + | ||
- | + | ||
- | http.end(); | + | |
- | } | + | |
- | + | ||
- | // Allocate JsonBuffer | + | |
- | // Use arduinojson.org/ | + | |
- | const size_t capacity = JSON_ARRAY_SIZE(2) + JSON_OBJECT_SIZE(1) + 2*JSON_OBJECT_SIZE(2) + 2*JSON_OBJECT_SIZE(4) + JSON_OBJECT_SIZE(5) + JSON_OBJECT_SIZE(6) + JSON_OBJECT_SIZE(12) + 420; | + | |
- | DynamicJsonBuffer jsonBuf(capacity); | + | |
- | + | ||
- | // DynamicJsonBuffer jsonBuf; | + | |
- | JsonObject &root = jsonBuf.parseObject(line); | + | |
- | if (!root.success()) | + | |
- | { | + | |
- | Serial.println(" | + | |
- | return; | + | |
- | } | + | |
- | // | + | |
- | weatherDescription = root[" | + | |
- | weatherDescription.toLowerCase(); | + | |
- | // weatherLocation = root[" | + | |
- | // country = root[" | + | |
- | temp = root[" | + | |
- | humidity = root[" | + | |
- | pressure = root[" | + | |
- | tempMin = root[" | + | |
- | tempMax = root[" | + | |
- | windSpeed = root[" | + | |
- | windDeg = root[" | + | |
- | clouds = root[" | + | |
- | + | ||
- | | + | |
- | + | ||
- | String windDirection = "N NOO SOS SWW NW"; | + | |
- | int wr = (windDeg+22)%360/ | + | |
- | // Serial.println(wr); | + | |
- | + | ||
- | String dayName[] = {" | + | |
- | + | ||
- | // For test purposes | + | |
- | // String(d) = " | + | |
- | // String(m) = " | + | |
- | // w = 2; // was monday in year 2020 | + | |
- | + | ||
- | String deg = String(char(' | + | |
- | String arrowUp = String(char(' | + | |
- | + | ||
- | if (String(d) == " | + | |
- | weatherString = " | + | |
- | } else { | + | |
- | weatherString = " | + | |
- | } | + | |
- | weatherString += | + | |
- | weatherString += " | + | |
- | weatherString += " | + | |
- | weatherString += " | + | |
- | // weatherString += " | + | |
- | weatherString += " | + | |
- | weatherString += String(windDeg) + deg + " | + | |
- | weatherString += arrowUp + " | + | |
- | Serial.println(weatherString); | + | |
- | } | + | |
- | + | ||
- | } | + | |
- | LED-Uhr-Wetter-mp4 | + | |
- | + | ||
- | Towel Day | + | |
- | Die Uhr kann natürlich auch an Geburtstage und andere wichtige Termine erinnern. Eine einfache Abfrage im Script machts möglich. Das Beispiel für den Nerd: Towel Day am 25.05. ist in obigem Script eingebaut. | + | |
- | + | ||
- | Live Anzeige vom Textserver | + | |
- | Andere Variante für Live-Anzeige: | + | |
- | + | ||
- | void getLocalWebData () { | + | |
- | + | ||
- | String Line; | + | |
- | + | ||
- | if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status | + | |
- | + | ||
- | HTTPClient http; //Declare an object of class HTTPClient | + | |
- | + | ||
- | http.begin(" | + | |
- | + | ||
- | int httpCode = http.GET(); | + | |
- | Serial.print(" | + | |
- | Serial.println(httpCode); | + | |
- | + | ||
- | if (httpCode > 0) { //Check the returning code | + | |
- | + | ||
- | Line = http.getString(); | + | |
- | + | ||
- | Serial.print(" | + | |
- | Serial.println(Line); | + | |
- | + | ||
- | WebLine = " | + | |
- | + | ||
- | http.end(); | + | |
- | + | ||
- | } | + | |
- | } | + | |
- | + | ||
- | getTimeLocal(); | + | |
- | + | ||
- | Serial.println(WebLine); | + | |
- | } | + | |
- | + | ||
- | Zum Abschluß eine Wortuhr | + | |
- | Schließlich wurde die Uhr auf reine Textanzeige umgestellt. Die Anzeige ist für Slowdown-Nerds: | + | |
- | + | ||
- | // | + | |
- | + | ||
- | int Stunde; | + | |
- | String MinutenText; | + | |
- | String StundenText; | + | |
- | + | ||
- | void WordClock () { | + | |
- | + | ||
- | getTimeLocal(); | + | |
- | Serial.println(" | + | |
- | if (h > 12) {Stunde = h-12;} else {Stunde = h;} | + | |
- | + | ||
- | // Serial.print(Stunde); | + | |
- | + | ||
- | if (m == 0) {MinutenText = "genau ";} | + | |
- | if (m > 0) {MinutenText = "kurz nach ";} | + | |
- | if (m > 2) {MinutenText = "funf nach ";} | + | |
- | if (m > 7) {MinutenText = "zehn nach ";} | + | |
- | if (m > 12) {MinutenText = " | + | |
- | if (m > 17) {MinutenText = " | + | |
- | if (m > 22) {MinutenText = "funf vor halb "; Stunde = Stunde + 1;} | + | |
- | if (m > 27) {MinutenText = "halb ";} | + | |
- | if (m > 32) {MinutenText = "funf nach halb ";} | + | |
- | if (m > 37) {MinutenText = " | + | |
- | if (m > 42) {MinutenText = " | + | |
- | if (m > 47) {MinutenText = "zehn vor ";} | + | |
- | if (m > 52) {MinutenText = "funf vor ";} | + | |
- | if (m > 57) {MinutenText = " | + | |
- | + | ||
- | if (Stunde == 1) {StundenText = " | + | |
- | if (Stunde == 2) {StundenText = " | + | |
- | if (Stunde == 3) {StundenText = " | + | |
- | if (Stunde == 4) {StundenText = " | + | |
- | if (Stunde == 5) {StundenText = " | + | |
- | if (Stunde == 6) {StundenText = " | + | |
- | if (Stunde == 7) {StundenText = " | + | |
- | if (Stunde == 8) {StundenText = " | + | |
- | if (Stunde == 9) {StundenText = " | + | |
- | if (Stunde == 10) {StundenText = " | + | |
- | if (Stunde == 11) {StundenText = " | + | |
- | if (Stunde == 12) {StundenText = " | + | |
- | + | ||
- | + | ||
- | // Serial.print(MinutenText); | + | |
- | // Serial.println(StundenText); | + | |
- | + | ||
- | TimeString = " | + | |
- | Serial.println(TimeString); | + | |
- | + | ||
- | } | + | |
- | Viel Spaß beim Mitmachen wünscht mancas! | + |
projekte/homecomfort.1611333873.txt.gz · Zuletzt geändert: 2021/01/22 16:44 von mancas