A friend of mine, who is an experienced maker, has now built a “small” replica for his living room using a 3D printer and a NeoPixel strip. I supported this with an ANNEX32 scrict code for an ESP32 controller.
The result is now located in a living room and looks like this: This is the Web interface to control the colors and brightnes of the NEoPixels in the tower.
As usual, I chose an Annex32 script to quickly get a prototype up and running, and to adjust the colors and correct distribution of the LEDs.
To adapt it to our needs and try it out, I first tested the script in the WOKWI’s Annex32 emulator, and so my friend was able to access it quickly.
The final result, now in the living room, is certainly something my friend can be proud of!
' KOPFZEILE1$ = "- R H E I N T U R M - Z E I T P E G E L -" KOPFZEILE2$ = " mit 60er-NEOPIXEL-Strip" KOPFZEILE3$ = " - V2.1 -" ' Peter.Neufeld@gmx.de 03.2017 // 04.2025
S1_pos = 0 'Position der ersten Sekunden-LED im Streifen (Anfang bei 0) LED_PIN = 27 'GPIO Daten-Pin des ESP32 für die NeoPixel-data LED_TOP_PIN = 26 'EINZELNE klassische 3mm-LED an Turmspitze, blinkt 1 pro Sekunde LED_NUM = 70 'Anzahl der NeoPixel-LEDs im Streifen
LED_SEC_E = 1 'Anzahl der Trenn-LEDs nach den Sekunden-Einern LED_SEC_Z = 2 'Anzahl der Trenn-LEDs nach den Sekunden-Zehnern LED_MIN_E = 1 'Anzahl der Trenn-LEDs nach den MINUTEN-Einern LED_MIN_Z = 2 'Anzahl der Trenn-LEDs nach den MINUTEN-Zehnern LED_H_E = 1 'Anzahl der Trenn-LEDs nach den STUNDEN-Einern LED_H_Z = 1 'Anzahl der Trenn-LEDs nach den STUNDEN-Zehnern
LED_BLINK_NUM = 4 'Anzahl der blinkenden LEDs in der Spitze(=letzte LEDs am Streifenende) LED_BLINK_POS = LED_NUM - LED_BLINK_NUM 'Blinkende LED an der Turmspitze LED_DIMM = 200 'Helligkeit der Trenn-LEDs LED_blink_DIMM = LED_DIMM 'Helligkeit der blinkenden LEDs
STATUS$ = "Anfang" 'Variable zum Testen R = 200 'R G B -Werte der UHR-LEDs falls bisher noch nicht im EEPROM gespeichert G = 200 B = 200 ZEIT$ = "00:00:00" TOGGLE = 0 pin.mode LED_TOP_PIN,output gosub einstellungen_lesen
' Startposition der jeweils ersten LED fuer die ' einzelnen Stellen der Sekunden, Minuten und Stunden ' pos + LED-Anzahl + Trenner-LEDs s2_pos = s1_pos + 9 + LED_SEC_E 'Sekunden-Zehner m1_pos = s2_pos + 5 + LED_SEC_Z 'Minuten-Einer m2_pos = m1_pos + 9 + LED_MIN_E 'Minuten-Zehner h1_pos = m2_pos + 5 + LED_MIN_Z 'Stunden-Einer h2_pos = h1_pos + 9 + LED_H_E 'Stunden-Zehner LED_BLINK_NUN = 3 R_alt = R + 1 ' zum Erkennen neuer R G B Werte aus der GUI G_alt = G B_alt = B
save_stat$ = "" 'Status fuer Werte in EEProm gesichert
gosub NEOPIXEL_start ' --Hauptseite mit 1s_timer aus WEBPAGE---- STATUS$ = "Hauptschleife" m1_alt = 99 h1_alt = 99
if ( R <> R_alt ) or ( G <> G_alt ) or ( B <> B_alt ) then m1_alt = 99 h1_alt = 99 R_alt = R G_alt = G B_alt = B end if
'sekunden '-------- if s1 = 0 then neo.strip s1_pos,s1_pos + 8,0,0,0,1 else neo.strip s1_pos,s1_pos + s1 -1,R,G,B,1 end if if s2 = 0 then neo.strip s2_pos,s2_pos + 4,0,0,0,1 else neo.strip s2_pos,s2_pos + s2 -1,R,G,B,1 end if
'minuten '------- if m1_alt <> m1 then m1_alt = m1 if m1 = 0 then neo.strip m1_pos,m1_pos + 8,0,0,0,1 else neo.strip m1_pos,m1_pos + m1 -1,R,G,B,1 end if if m2 = 0 then neo.strip m2_pos,m2_pos + 4,0,0,0,1 else neo.strip m2_pos,m2_pos + m2 -1,R,G,B,1 end if end if
'Stunden '------- if h1_alt <> h1 then h1_alt = h1 if h1 = 0 then neo.strip h1_pos,h1_pos + 8,0,0,0,1 else neo.strip h1_pos,h1_pos + h1 -1,R,G,B,1 end if if h2 = 0 then neo.strip h2_pos,h2_pos + 4,0,0,0,1 else neo.strip h2_pos,h2_pos + h2 -1,R,G,B,1 end if end if
'#### Trenner-LEDs und Turmspitze ###### 'Trenner-LED innerhalb Sekunde (rot) neo.strip s2_pos - LED_SEC_E,s2_pos-1,LED_DIMM,0,0,1
'rot blinkende Turmspitze pin(LED_TOP_PIN) = 1 - pin(LED_TOP_PIN) 'einzelne klassische 3mm-LED an Turmspitze TOGGLE=1-TOGGLE if (TOGGLE =0) then 'Helligkeit der blinkenden LEDs = AN LED_blink_DIMM = LED_DIMM save_stat$ = "" 'Loeschen des "OK" 1s nach erfolgreichem [einstellungen_schreiben] 'save_stat = "ramfree:" & ramfree() else 'Helligkeit der blinkenden LEDs = AUS LED_blink_DIMM = LED_DIMM/2 end if
'!!!Erst hier schreibt neo den bisher aufgebauten Puffer!!! neo.strip LED_BLINK_pos , LED_BLINK_POS + LED_BLINK_NUM -1,LED_BLINK_DIMM,0,0,0 '!!!ERST HIER WIRD DER NeoPixel-STREIFEN ANGESTEUERT
NEOPIXEL_start: '--------------- ' Initialisieren und Test der Neopixel ' !!!!!!!!!!! MIT NEOPIXEL an GPIO2 !!!!!!!!!!!!!!! STATUS$ = "NEOPIXEL_start_A" neo.setup LED_PIN,LED_NUM for i = 0 to LED_NUM neo.pixel i,200,200,200,0 pause 20 next i pause 1000 neo.strip 0,LED_NUM,0,0,0 STATUS$ = "NEOPIXEL_start_E" return
Möchten Sie einen Kommentar mit Ihrer Bewertung hinterlassen? Bitte melden Sie sich unten an. Nicht gewünscht? Dann schließen Sie einfach dieses Fenster.
Diskussion (0 Kommentare)