WordClocks with NeoPixel-Matrix
WordClocks with 8*8 or 10*10 NeoPixel-Matrix, ESP8266 and a BASIC-Program based on ANNEX WiFi-RDS . Matrixes are made with Laserprinter or 3D-Printer.
During the last year I built some WordClocks for some friends who saw the one I built first and fell in love with it.
This resulted in some different versions with 8x8, 8x8+4 or 10x10 NeoPixel matrix in various housings - So it was fortunately no mass production ;-)
The display masks of the clocks are made with Laserprinter or 3D-Printer). These are in German language, but there are masks in other languages available on the net and the BASIC-program can be adapted accordingly .
The different types of matrixes are controlled by the same BASIC-program and Webinterface.
With the webinterface the type of display and the color and brightness of active and inactive words can be adjusted.
The settings are saved for the next reboot.
Programming is based on a BASIC-Script and ANNEX-WiFi-RDS for any ESP8266-Controler-module (e.g.: Wemos D1 Mini).
The program text is currently still somewhat German in the variable names and comments
This is what some of the results look like:
https://vimeo.com/221749384
https://vimeo.com/368983581
https://vimeo.com/221750564
The BASIC code for the ESP8266 is created very easily with ANNEX WiFi RDS and looks like this
' W o r d C l o c k mit 10x10- und 8*8-Matrix
' Peter.Neufeld@me.com
' JANUAR 2018(ESPbasic) // NOVEMBER 2019(ANNEX-RDS)
' 10x10 oder 8x8(+4) NeoPixel an !!!!GPIO02 = D04!!!!!
' 8x8+4 = mit 8x8 mit 4 zusaetzlichen Minuten LEDs
' Zeigt beim Start die IP-Adresse als Stunden an
' TYPUS=[10x10|8x8|8x8+4] in EEPROM gespeichert
' Sommer-/Winterzeit automatisch
' (CET-1CEST,M3.5.0,M10.5.0/3 in config-page)
ver$ = "V7.2 ANNEX"
zeit$ = time$
gosub STARTWERTE
gosub HW_TYPUS
gosub NEO_SETUP
gosub WebInterface
timer0 4000 , WebInterface
gosub ShowIPADR
onhtmlreload WebInterface
onhtmlchange WebInterface
' Falls keine Verbindung zu einem WALAN besteht
' und keine NTP-Zeit geholt werden konnte:
' DEMO-Modus und rote Anzeige
if IPADR$="192.168.4.1" then
MODUS$ = "DEMO"
R = 50
G = 0
B = 0
else
MODUS$ = "UHR"
end if
' !!!!!!!!!!!!!
option.WDT 10000 ' set the WDT at 10 seconds
timer0 2000, MAIN_PRGM
wait
' ##############################################################
MAIN_PRGM:
'wlog "MAIN_PRGM", time$
option.WDTreset
zeit$ = time$
if MODUS$ = "UHR" then COLOR$ = "NEIN"
if MODUS$ = "COLOR_DEMO" then
timer0 0
gosub color_demo
pause 3000
timer0 2000, MAIN_PRGM
MODUS$ = "UHR"
R_alt = R_alt + 1
endif
if (MODUS$ = "UHR") or (MODUS$ = "UHR_MIT_COLOR_WECHSEL") then
mm = val(word$(time$,2,":"))
end if
if MODUS$ = "DEMO" then
COLOR$ = "NEIN"
mm = mm + 3
if mm > 59 then
mm = 0
hh = hh+1
if hh > 12 then hh = 1
end if
end if
ss = val(word$(time$,3,":"))
if (MODUS$ = "UHR") or (MODUS$ = "UHR_MIT_COLOR_WECHSEL") then
hh = val(word$(time$,1,":"))
end if
If hh = 0 then
hh = 12
end if
if hh >12 then hh = hh - 12
mm_mod = mm
if ( RX <> RX_alt ) or ( GX <> GX_alt ) or ( BX <> BX_alt ) then
RX_alt = RX
GX_alt = GX
BX_alt = BX
NEO.STRIP LED_start,LED_end,RX,GX,BX
R_alt = R_alt + 1
end if
if TYPUS$ <> TYPUS_alt$ then
gosub HW_TYPUS
TYPUS_alt$ = TYPUS$
mm_alt = mm_alt + 1
NEO.STRIP LED_start,LED_end,RX,GX,BX
end if
'komplexe Uhrzeitumsetzung fuer neopixel nur ansteuern, wenn sich etwas geaendert hat
if ( hh <> hh_alt ) or (mm <> mm_alt) or ( R <> R_alt ) or ( G <> G_alt ) or ( B <> B_alt ) then
hh_alt = hh
mm_alt = mm
R_alt = R
G_alt = G
B_alt = B
If(TYPUS$ = "8x8+4") then
mm_mod = mm_mod mod 5
if mm_mod > 0 then
NEO.STRIP LED_end +1,LED_end + mm_mod,R,G,B
NEO.STRIP LED_end + mm_mod + 1,LED_end + 5,RX,GX,BX
else
NEO.STRIP LED_end +1,LED_end + 5,RX,GX,BX
end if
endif
gosub showtime
else
' SMILY]
if LED_blink > 0 then
if ON = 1 then
ON = 0
NEO.STRIP LED_blink,LED_blink + 1,R/2,G/2,B/2
else
ON = 1
NEO.STRIP LED_blink,LED_blink + 1,R,G,B
end if
end if
end if
return
' #######################################################################
' #######################################################################
showtime:
if TYPUS$ = "10x10" then
gosub showtime_10x10
else
gosub showtime_8x8
end if
return
' #######################################################################
showtime_10x10:
'alles auf Hintergrund
NEO.STRIP 0,LED_END,RX,GX,BX,1
'ES:
NEO.STRIP 0,2,R,G,B,1
t$ = ""
'IST:
NEO.STRIP 3,5,R,G,B,1
'FUNF:
if ((mm >4) and (mm<10)) or ((mm >54) and (mm <60)) or ((mm >24) and (mm<30)) or ((mm >34) and (mm <40)) then
NEO.STRIP 6,9,R,G,B,1
t$ = t$ + "FUENF "
end if
'ZEHN:
if ((mm >9) and (mm<15)) or ((mm >49) and (mm <55)) then
NEO.STRIP 10,13,R,G,B,1
t$ = t$ + "ZEHN "
end if
'ZWANZIG:
if ((mm >19) and (mm<25)) or ((mm >39) and (mm <45)) then
NEO.STRIP 14,19,R,G,B,1
t$ = t$ + "ZWANZIG "
end if
'NACH1 nach-halb
if ((mm > 34) and (mm<40)) then
NEO.STRIP 20,23,R,G,B,1
t$ = t$ + "NACH "
end if
'VIERTEL:
if ((mm >14) and (mm<20)) or ((mm >44) and (mm <50)) then
NEO.STRIP 24,29,R,G,B,1
t$ = t$ + "VIERTEL "
end if
'VOR:
if ((mm >24) and (mm <30))or ((mm > 39) and (mm<60)) then
NEO.STRIP 30,32,R,G,B,1
t$ = t$ + "VOR "
end if
'NACH2:
if ((mm >4) and (mm<25)) then
NEO.STRIP 33,35,R,G,B,1
t$ = t$ + "NACH "
endif
'HALB:
if (mm>24) and (mm<40) then
NEO.STRIP 36,39,R,G,B,1
t$ = t$ + "HALB "
end if
' ab 5 vor halb immer stunde = stunde + 1
hhx=hh
if (mm >24) and (mm<60) then
hhx = hh+1
if hhx = 13 then
hhx = 1
end if
end if
'1
if hhx=1 then
NEO.STRIP 40,45,R,G,B,1
t$ = t$ + "EINS "
end if
'2
if hhx=2 then
NEO.STRIP 46,49,R,G,B,1
t$ = t$ + "ZWEI "
end if
'3
if hhx=3 then
NEO.STRIP 50,53,R,G,B,1
t$ = t$ + "DREI "
end if
'4
if hhx=4 then
NEO.STRIP 56,59,R,G,B,1
t$ = t$ + "VIER "
end if
'5
if hhx=5 then
NEO.STRIP 60,64,R,G,B,1
t$ = t$ + "FUENF "
end if
'6
if hhx=6 then
NEO.STRIP 65,69,R,G,B,1
t$ = t$ + "SECHS "
end if
'7
if hhx=7 then
NEO.STRIP 70,75,R,G,B,1
t$ = t$ + "SIEBEN "
end if
'8
if hhx = 8 then
NEO.STRIP 76,79,R,G,B,1
t$ = t$ + "ACHT "
end if
'9
if hhx = 9 then
NEO.STRIP 80,83,R,G,B,1
t$ = t$ + "NEUN "
end if
'10
if hhx = 10 then
NEO.STRIP 84,86,R,G,B,1
t$ = t$ + "ZEHN "
end if
'11
if hhx = 11 then
NEO.STRIP 87,89,R,G,B,1
t$ = t$ + "ELF "
end if
'12
if hhx = 12 then
NEO.STRIP 90,95,R,G,B,1
t$ = t$ + "ZWOELF "
end if
'UHR:
if mm <5 then
'bisher NEO.STRIP nur im RAM, nun mit refresh!!
NEO.STRIP 96,99,R,G,B,0
t$ = t$ + "UHR "
else
'bisher NEO.STRIP nur im RAM, nun mit refresh!!
NEO.STRIP 96,99,RX,GX,BX,0
end if
tt$ = t$
return
' #######################################################################
showtime_8x8:
'bis 4 nach:
if (mm<5) then
t$ = "genau "
NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF
NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN
NEO.STRIP 12,15,RX,GX,BX,1 'NACH
NEO.STRIP 8,10,RX,GX,BX,1 'VOR
NEO.STRIP 16,19,RX,GX,BX,0 'HALB
goto STUNDEN
end if
'FUNF nach:
if (mm >4) and (mm<10) then
t$ = "FUENF nach "
NEO.STRIP 0, 3,R,G,B,1 'FUENF
NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN
NEO.STRIP 12,15,R,G,B,1 'NACH
NEO.STRIP 8,10,RX,GX,BX,1 'VOR
NEO.STRIP 16,19,RX,GX,BX,1 'HALB
goto STUNDEN
end if
'ZEHN nach:
if (mm >9) and (mm<15) then
t$ = "ZEHN nach "
NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF
NEO.STRIP 4, 7,R,G,B,1 'ZEHN
NEO.STRIP 12,15,R,G,B,1 'NACH
NEO.STRIP 8,10,RX,GX,BX,1 'VOR
NEO.STRIP 16,19,RX,GX,BX,1 'HALB
goto STUNDEN
end if
'FUENFZEHN nach:
if (mm >14) and (mm<20) then
t$ = "FUENFZEHN nach "
NEO.STRIP 0, 3,R,G,B,1 'FUENF
NEO.STRIP 4, 7,R,G,B,1 'ZEHN
NEO.STRIP 12,15,R,G,B,1 'NACH
NEO.STRIP 8,10,RX,GX,BX,1 'VOR
NEO.STRIP 16,19,RX,GX,BX,1 'HALB
goto STUNDEN
end if
'ZEHN vor HALB:
if (mm >19) and (mm<25) then
t$ = "ZEHN vor HALB "
NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF
NEO.STRIP 4, 7,R,G,B,1 'ZEHN
NEO.STRIP 12,15,RX,GX,BX,1 'NACH
NEO.STRIP 8,10,R,G,B,1 'VOR
NEO.STRIP 16,19,R,G,B,1 'HALB
goto STUNDEN
end if
'FUENF vor HALB:
if (mm >24) and (mm<30) then
t$ = "FUENF vor HALB "
NEO.STRIP 0, 3,R,G,B,1 'FUENF
NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN
NEO.STRIP 12,15,RX,GX,BX,1 'NACH
NEO.STRIP 8,10,R,G,B,1 'VOR
NEO.STRIP 16,19,R,G,B,1 'HALB
goto STUNDEN
end if
'HALB:
if (mm >29) and (mm<35) then
t$ = "HALB "
NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF
NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN
NEO.STRIP 12,15,RX,GX,BX,1 'NACH
NEO.STRIP 8,10,RX,GX,BX,1 'VOR
NEO.STRIP 16,19,R,G,B,1 'HALB
goto STUNDEN
end if
'FUENF nach HALB:
if (mm >34) and (mm<40) then
t$ = "FUENF nach HALB "
NEO.STRIP 0, 3,R,G,B,1 'FUENF
NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN
NEO.STRIP 12,15,R,G,B,1 'NACH
NEO.STRIP 8,10,RX,GX,BX,1 'VOR
NEO.STRIP 16,19,R,G,B,1 'HALB
goto STUNDEN
end if
'ZEHN nach HALB:
if (mm >39) and (mm<45) then
t$ = "ZEHN nach HALB "
NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF
NEO.STRIP 4, 7,R,G,B,1 'ZEHN
NEO.STRIP 12,15,R,G,B,1 'NACH
NEO.STRIP 8,10,RX,GX,BX,1 'VOR
NEO.STRIP 16,19,R,G,B,1 'HALB
goto STUNDEN
end if
'FUENFZEHN vor:
if (mm >44) and (mm<50) then
t$ = "FUENFZEHN vor "
NEO.STRIP 0, 3,R,G,B,1 'FUENF
NEO.STRIP 4, 7,R,G,B,1 'ZEHN
NEO.STRIP 12,15,RX,GX,BX,1 'NACH
NEO.STRIP 8,10,R,G,B,1 'VOR
NEO.STRIP 16,19,RX,GX,BX,1 'HALB
goto STUNDEN
end if
'ZEHN vor :
if (mm >49) and (mm<55) then
t$ = "ZEHN vor "
NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF
NEO.STRIP 4, 7,R,G,B,1 'ZEHN
NEO.STRIP 12,15,RX,GX,BX,1 'NACH
NEO.STRIP 8,10,R,G,B,1 'VOR
NEO.STRIP 16,19,RX,GX,BX,1 'HALB
goto STUNDEN
end if
'FUENF vor :
if (mm >54) and (mm<60) then
t$ = "FUENF vor "
NEO.STRIP 0, 3,R,G,B,1 'FUENF
NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN
NEO.STRIP 12,15,RX,GX,BX,1 'NACH
NEO.STRIP 8,10,R,G,B,1 'VOR
NEO.STRIP 16,19,RX,GX,BX,1 'HALB
goto STUNDEN
end if
STUNDEN:
' ab 10 vor halb immer stunde = stunde + 1
hhx=hh
if (mm >19) and (mm<60) then
hhx = hh+1
if hhx = 13 then
hhx = 1
end if
end if
NEO.STRIP 20,63,RX,GX,BX,1
'1
if hhx=1 then
NEO.STRIP 24,27,R,G,B,1
NEO.STRIP 28,63,RX,GX,BX,0
t$ = t$ + "EINS "
end if
'2
if hhx=2 then
NEO.STRIP 24,27,RX,GX,BX,1
NEO.STRIP 35,36,R,G,B,1
NEO.STRIP 45,46,R,G,B,0
t$ = t$ + "ZWEI "
end if
'3
if hhx=3 then
NEO.STRIP 35,36,RX,GX,BX,1
NEO.STRIP 43,46,R,G,B,0
t$ = t$ + "DREI "
end if
'4
if hhx=4 then
NEO.STRIP 20,23,R,G,B,1
NEO.STRIP 43,46,RX,GX,BX,0
t$ = t$ + "VIER "
end if
'5
if hhx=5 then
NEO.STRIP 20,23,RX,GX,BX,1
NEO.PIXEL 39,R,G,B,1
NEO.PIXEL 47,R,G,B,1
NEO.PIXEL 55,R,G,B,1
NEO.PIXEL 63,R,G,B,0
t$ = t$ + "FUENF "
end if
'6
if hhx=6 then
NEO.STRIP 27,31,R,G,B,1
NEO.STRIP 32,63,RX,GX,BX,0
t$ = t$ + "SECHS "
end if
'7
if hhx=7 then
NEO.STRIP 32,34,R,G,B,1
NEO.STRIP 40,42,R,G,B,1
NEO.STRIP 27,31,RX,GX,BX,0
t$ = t$ + "SIEBEN "
end if
'8
if hhx = 8 then
NEO.STRIP 56,59,R,G,B,1
NEO.STRIP 32,34,RX,GX,BX,1
NEO.STRIP 40,42,RX,GX,BX,0
t$ = t$ + "ACHT "
end if
'9
if hhx = 9 then
NEO.STRIP 52,55,R,G,B,1
NEO.STRIP 56,59,RX,GX,BX,0
t$ = t$ + "NEUN "
end if
'10
if hhx = 10 then
NEO.STRIP 48,51,R,G,B,1
NEO.STRIP 52,55,RX,GX,BX,0
t$ = t$ + "ZEHN "
end if
'11
if hhx = 11 then
NEO.STRIP 61,63,R,G,B,1
NEO.STRIP 48,51,RX,GX,BX,0
t$ = t$ + "ELF "
end if
'12
if hhx = 12 then
NEO.STRIP 35,39,R,G,B,1
NEO.STRIP 61,63,RX,GX,BX,0
t$ = t$ + "ZWOELF "
end if
tt$ = t$
return
' #######################################################################
STARTWERTE:
ZEIT$ = ""
IPADR$ = WORD$(IP$,1)
TYPUS$ = ""
TYPUS_alt$= "x"
Settings$ = ""
tt$ = "ES IST ..."
t$ = tt$
R = 0
G = 60
B = 50
R_alt = R + 1
G_alt = G
B_alt = B
RX = 5
GX = 5
BX = 5
RX_alt = RX
GX_alt = GX
BX_alt = BX
MODUS$ = "UHR"
mm = 1
mm_alt = 2
hh = 1
hh_alt = 2
ss = 1
mm_mod = 0
ON = 0
' !!!!!!!!!!!!!!!!!!!!!!!!!!
gosub EINSTELLUNGEN_LESEN
return
' #########################################################################
WebInterface:
cls
autorefresh 1000
'wlog time$
a$=""
a$ = a$ + "- - - W O R D C L O C K - - "
a$ = a$ + "################## "+ ver$
a$ = a$ + " #####################"
if IPADR$= "192.168.4.1" then
a$ = a$ + |Die Uhr ist gerade NICHT in einem WLAN angemeldet
|
a$ = a$ + |Evtl sind die Anmeldedaten falsch ...
|
a$ = a$ + |oder die Entfernung zu dem WLAN-AP ist zu gross.
|
a$ = a$ + |Bitte auf der CONFIG-PAGE |
a$ = a$ + |oben bei StationMode
die WLAN-SSID und das Kennwort
|
a$ = a$ + |eintragen bzw berichtigen.
|
a$ = a$ + |Weiter zur CONFIG-PAGE
|
else
a$ = a$ + textbox$(zeit$) + " - - - - " + TEXTBOX$(tt$)
a$ = a$ + "
Farbe der aktiven Zeichen:
"
a$ = a$ + SLIDER$(R,0,180)+ "R:" + TEXTBOX$(R) + "
"
a$ = a$ + SLIDER$(G,0,180)+ "G:" + TEXTBOX$(G) + "
"
a$ = a$ + SLIDER$(B,0,180)+ "B:" + TEXTBOX$(B) + "
"
a$ = a$ + "Farbe des Hintergrunds:
"
a$ = a$ + SLIDER$(RX,0,30) + "RX:" + TEXTBOX$(RX) + "
"
a$ = a$ + SLIDER$(GX,0,30) + "GX:" + TEXTBOX$(GX) + "
"
a$ = a$ + SLIDER$(BX,0,30) + "BX:" + TEXTBOX$(BX) + "
"
a$ = a$ +"
" + LISTBOX$( MODUS$, "UHR,COLOR_DEMO,DEMO","cssLB")+ " = Betriebs-Modus"
a$ = a$ +"
" + LISTBOX$( TYPUS$, "8x8,8x8+4,10x10","cssLB")+ " = Uhr-Hardware-Typ"
a$ = a$ + "
"
a$ = a$ + BUTTON$("EINSTELLUNGEN SICHERN", EINSTELLUNGEN_SCHREIBEN,"cssBT")
end if
a$ = a$ + "################## "+ ver$ + " #####################"
a$ = a$ + cssid$("cssLB"," width:150px;height:2em; font-size:1.0em; ")
a$ = a$ + cssid$("cssBT"," width:320px;height:2em; font-size:1.0em; border-radius:1.1em; padding:.5em")
html a$
a$=""
return
' ##############################################################
COLOR_DEMO:
mm= 0
for yy= 0 to LED_SPALTEN
for xx = 0 to LED_SPALTEN
rr = 80 - 10 * xx
gg = 10 * xx
bb = 10 * yy
NEO.PIXEL xx + LED_SPALTEN * yy,rr,gg,bb,1
NEO.PIXEL LED_end + 1 - (xx + LED_SPALTEN * yy),rr,gg,bb,0
next xx
next yy
for i = LED_end to 2 step -1
NEO.PIXEL i,rnd(100),rnd(100),rnd(100),1
NEO.PIXEL LED_end-i,rnd(100),rnd(100),rnd(100),0
next i
for yy= 0 to LED_SPALTEN
for xx = 0 to LED_SPALTEN
bb = 80 - 10 * xx
gg = 10 * xx
rr = 10 * yy
NEO.PIXEL xx + 8 * yy,rr,gg,bb,1
NEO.PIXEL LED_end + 1- (xx + 8 * yy),rr,gg,bb,0
next xx
next yy
for yy= LED_SPALTEN to 0 step -1
for xx = 0 to LED_SPALTEN
rr = 80 - 10 * xx
gg = 10 * xx
bb = 10 * yy
NEO.STRIP 0,LED_end,rr,gg,bb
pause 100
next xx
next yy
for yy= 0 to LED_SPALTEN
for xx = 0 to LED_SPALTEN
rr = 80 - 10 * xx
gg = 10 * xx
bb = 10 * yy
NEO.STRIP 0,LED_end,rr,gg,bb
'pause 100
next xx
next yy
NEO.STRIP 0,LED_end,RX,GX,BX
return
' ##############################################################
EINSTELLUNGEN_LESEN:
if file.exists("/Wordclock_settings") then SETTINGS$ = file.read$("/Wordclock_settings")
if SETTINGS$ <> "" then
R = val(file.read$("/Wordclock_R"))
G = val(file.read$("/Wordclock_G"))
B = val(file.read$("/Wordclock_B"))
RX = val(file.read$("/Wordclock_RX"))
GX = val(file.read$("/Wordclock_GX"))
BX = val(file.read$("/Wordclock_BX"))
TYPUS$= file.read$("/Wordclock_TYPUS")
endif
if TYPUS$ = "" then TYPUS$ = "8x8"
return
' ##############################################################
EINSTELLUNGEN_SCHREIBEN:
' schreibt die Einstellungen in einzelne Dateien im Flash
tt$ = "Werte schreiben"
xxx$ = "Wordclock-Daten"
file.save "/Wordclock_settings",xxx$
file.save "/Wordclock_TYPUS",TYPUS$
file.save "/Wordclock_R", str$(R)
file.save "/Wordclock_G", str$(G)
file.save "/Wordclock_B", str$(B)
file.save "/Wordclock_RX", str$(RX)
file.save "/Wordclock_GX", str$(GX)
file.save "/Wordclock_BX", str$(BX)
save_stat$ = "OK"
tt$ = "Werte wurden gesichert"
return
' ##############################################################
ShowIPADR:
'einzelne stellen der IP-Adresse als Stundenwert anzeigen
' 0 = 10
' Punkt = Anzeige komplett GRUEN
'
NEO.STRIP 0,LED_end + (m_LED *4),50,0,0
pause 900
NEO.STRIP 0,LED_end + (m_LED *4),0,0,0
IPADR$ = WORD$(IP$,1)
RR=R:GG=G:BB=B
ii=1
R=80:G=50:B=0
pp=0
for i = 1 to len(IPADR$)
tt$ =mid$(IPADR$,i,1)
if tt$ = "." then
pp =pp + 1
NEO.STRIP 0,LED_end,0,40,0
pause 400
if pp=3 then
R=0
G=100
B=0
endif
else
mm=0
hh=val(tt$)
if hh=0 then
hh= 10
end if
gosub showtime
end if
pause 1000
NEO.STRIP 0,LED_end,RX,GX,BX
'neo.cls()
next i
NEO.STRIP 0,LED_end,0,40,40
pause 2000
NEO.STRIP 0,LED_end,RX,GX,BX
R=RR:G=GG:B=BB
return
' ##############################################################
HW_TYPUS:
'Hardwaretyp der Uhr
if (TYPUS$ = "8x8") or (TYPUS$ = "8x8+4") or (TYPUS$ = "") then
'8*8-MATRIX-Uhr
'###############
LED_start = 0
LED_end = 63
LED_SPALTEN = 7 '= LED Anzahl pro Zeile minus 1!!!!!
LED_blink = 0
m_LED = 0 ' 0 zusaetzliche Minuten-LEDs vorhanden = 0
end if
if TYPUS$ = "8x8+4" then
m_LED = 1 ' 4 zusaetzliche Minuten-LEDs vorhanden = 1
end if
if TYPUS$ = "10x10" then
'10*10-MATRIX-Uhr
'###############
LED_start = 0
LED_end = 99
LED_SPALTEN = 9 '= LED Anzahl pro Zeile minus 1!!!!!
LED_blink = 54
m_LED = 0 ' 0 zusaetzliche Minuten-LEDs vorhanden = 0
end if
return
' ###############################################################
NEO_SETUP:
' !!!!!!!!!!! NEOPIXEL geht nur noch an GPIO02=D4 !!!!!!!!!!!!!!!
'Anzahl der LEDs incl Minuten-LED
neo.setup LED_end + (m_LED * 4)
'neo.setup 120
neo.strip LED_START, LED_END,0,0,0
return
' ##############################################################




Updates from the author
PeterN 5 years ago
Der Hersteller der original Wordclock untersagt eine Verwendung der WordClock-Schablonen auch in abgewandelten Formen sowohl zur kommerziellen als auch zur privaten Nutzung. Daher kann weder eine Bauanleitung einer ähnlichen Uhr veröffentlicht werden, noch dürfen entsprechende Front-Schablonen weitergegeben werden.
Sorry
PeterN 5 years ago
Here you will find information about connecting an external I2S-audio-module to the ESP32
https://groups.google.com/d/msgid/annex_wifi_rds/395ee303-74fa-47c2-be7c-cb2a9051c813%40googlegroups.com?utm_medium=email&utm_source=footer
The BASIC-Code for the extended version with audio capabilities (sorry - still for/in German version):
' W o r d C l o c k mit 10x10- und 8*8-Matrix ' Peter.Neufeld@gmx.com ' 01.2018: ESP8266 mit ESPbasic ' 11.2019:ESP8266 ' - Version für ESP8266 mit ANNEX-RDS ' - NeoPixel an GPIO02 = D04!!!!! ' 02.2020 ab V7.3: ' - Version für ESP32 mit ANNEX32 ' -- spricht die IP-Adresse beim Start ' -- Soundaugabe via I2S für Internet-Radio ' -- Sprachausgabe der Uhrzeit (alle 5Min, alle 1/4 Std oder 1/1 zur vollen Stunde) ' -- NeoPixel an GPIO12, da der externe I2S-Soundchip u.a. GPIO2 benötigt ' Mögliche Displays: ' - 10x10 (aber 11*10Zeichenschablone) ' - 8x8 ' - 8x8+4 = mit 8x8 mit 4 zusaetzlichen Minuten LEDs ' Zeigt beim Start die IP-Adresse als Stunden an ' ESP32: spricht die IP-Adresse beim Start ' TYPUS=[10x10|8x8|8x8+4] in EEPROM gespeichert ' Sommer-/Winterzeit automatisch ' dazu CET-1CEST,M3.5.0,M10.5.0/3 in config-page einstellen ver$ = "V7.3 ANNEX_MP3" WITH_MP3 = 1 'Internet-Radio with ANNEX32 ONLY DAC_extern = 1 'Sound am internen DAC oder auf externes I2S-Interface Gosub ESP32_ESP8266 gosub STARTWERTE gosub HW_TYPUS gosub NEO_SETUP gosub WebInterface timer0 4000 , WebInterface gosub ShowIPADR onhtmlreload WebInterface onhtmlchange WebInterface ' Falls keine Verbindung zu einem WALAN besteht ' und keine NTP-Zeit geholt werden konnte: ' DEMO-Modus und rote Anzeige if IPADR$="192.168.4.1" then MODUS$ = "DEMO" R = 50 G = 0 B = 0 else MODUS$ = "UHR" end if ' !!!!!!!!!!!!! timer0 2000, MAIN_PRGM if ANNEX32 then timer0 1000, MAIN_PRGM ' ANNEX32 wait ' ############################################################## MAIN_PRGM: 'wlog "MAIN_PRGM", time$ ''''''''''''''''''''''''''''''''''option.WDTreset IF WITH_MP3 then If VOLUME <> Volume_alt then VOLUME = (VOLUME mod 101) PLAY.VOLUME 0 'because file.save makes noise on I2S file.save "/Wordclock_VOLUME", str$(VOLUME) PLAY.VOLUME VOLUME VOLUME_ALT = VOLUME end if IF STATION$ <> STATION_ALT$ then Gosub INTERNET_RADIO STATION_ALT$ = STATION$ PLAY.VOLUME 0 'because file.save makes noise on I2S file.save "/Wordclock_STATION", STATION$ PLAY.VOLUME VOLUME end if end if zeit$ = time$ if MODUS$ = "UHR" then COLOR$ = "NEIN" if MODUS$ = "COLOR_DEMO" then timer0 0 gosub color_demo pause 3000 timer0 1000, MAIN_PRGM 'ESP8266 if ANNEX32 then timer0 2000, MAIN_PRGM MODUS$ = "UHR" R_alt = R_alt + 1 endif if (MODUS$ = "UHR") or (MODUS$ = "UHR_MIT_COLOR_WECHSEL") then mm = val(word$(time$,2,":")) end if if MODUS$ = "DEMO" then COLOR$ = "NEIN" mm = mm + 3 if mm > 59 then mm = 0 hh = hh+1 if hh > 12 then hh = 1 end if end if ss = val(word$(time$,3,":")) if (MODUS$ = "UHR") or (MODUS$ = "UHR_MIT_COLOR_WECHSEL") then hh = val(word$(time$,1,":")) end if If hh = 0 then hh = 12 end if if hh >12 then hh = hh - 12 mm_mod = mm if ( RX <> RX_alt ) or ( GX <> GX_alt ) or ( BX <> BX_alt ) then RX_alt = RX GX_alt = GX BX_alt = BX NEO.STRIP LED_start,LED_end,RX,GX,BX R_alt = R_alt + 1 end if if TYPUS$ <> TYPUS_alt$ then gosub HW_TYPUS TYPUS_alt$ = TYPUS$ mm_alt = mm_alt + 1 NEO.STRIP LED_start,LED_end,RX,GX,BX end if 'komplexe Uhrzeitumsetzung fuer neopixel nur ansteuern, wenn sich etwas geaendert hat if ( hh <> hh_alt ) or (mm <> mm_alt) or ( R <> R_alt ) or ( G <> G_alt ) or ( B <> B_alt ) then hh_alt = hh mm_alt = mm R_alt = R G_alt = G B_alt = B If(TYPUS$ = "8x8+4") then mm_mod = mm_mod mod 5 if mm_mod > 0 then NEO.STRIP LED_end +1,LED_end + mm_mod,R,G,B NEO.STRIP LED_end + mm_mod + 1,LED_end + 5,RX,GX,BX else NEO.STRIP LED_end +1,LED_end + 5,RX,GX,BX end if endif gosub showtime Gosub ZEITANSAGE else ' SMILY] if LED_blink > 0 then if ON = 1 then ON = 0 NEO.STRIP LED_blink,LED_blink + 1,R/2,G/2,B/2 else ON = 1 NEO.STRIP LED_blink,LED_blink + 1,R,G,B end if end if end if return ' ####################################################################### ZEITANSAGE: ' =====Zeitansage sprechen============================================== IF (MODUS$="UHR") and (with_MP3>0) and (ZEIT_TEXT$ <> ZEIT_TEXT_alt$) then ' wlog "XXXXXXX "+time$+" "+STATION$ play.volume volume if (STATION$= "ZEITANSAGE_1/1") then Play.voice "Es ist "+ZEIT_TEXT$,"de" endif if (STATION$= "ZEITANSAGE_1/4")and (MM_alt mod 15 = 0) then Play.voice "Es ist "+ZEIT_TEXT$,"de" endif if (STATION$= "ZEITANSAGE_STD")and (MM_alt = 0) then Play.voice "Es ist "+ZEIT_TEXT$,"de" endif ZEIT_TEXT_alt$=ZEIT_TEXT$ end if ' ####################################################################### showtime: if TYPUS$ = "10x10" then gosub showtime_10x10 else gosub showtime_8x8 end if return ' ####################################################################### showtime_10x10: 'alles auf Hintergrund NEO.STRIP 0,LED_END,RX,GX,BX,1 'ES: NEO.STRIP 0,2,R,G,B,1 t$ = "" 'IST: NEO.STRIP 3,5,R,G,B,1 'FUNF: if ((mm >4) and (mm<10)) or ((mm >54) and (mm <60)) or ((mm >24) and (mm<30)) or ((mm >34) and (mm <40)) then NEO.STRIP 6,9,R,G,B,1 t$ = t$ + "FUENF " end if 'ZEHN: if ((mm >9) and (mm<15)) or ((mm >49) and (mm <55)) then NEO.STRIP 10,13,R,G,B,1 t$ = t$ + "ZEHN " end if 'ZWANZIG: if ((mm >19) and (mm<25)) or ((mm >39) and (mm <45)) then NEO.STRIP 14,19,R,G,B,1 t$ = t$ + "ZWANZIG " end if 'NACH1 nach-halb if ((mm > 34) and (mm<40)) then NEO.STRIP 20,23,R,G,B,1 t$ = t$ + "NACH " end if 'VIERTEL: if ((mm >14) and (mm<20)) or ((mm >44) and (mm <50)) then NEO.STRIP 24,29,R,G,B,1 t$ = t$ + "VIERTEL " end if 'VOR: if ((mm >24) and (mm <30))or ((mm > 39) and (mm<60)) then NEO.STRIP 30,32,R,G,B,1 t$ = t$ + "VOR " end if 'NACH2: if ((mm >4) and (mm<25)) then NEO.STRIP 33,35,R,G,B,1 t$ = t$ + "NACH " endif 'HALB: if (mm>24) and (mm<40) then NEO.STRIP 36,39,R,G,B,1 t$ = t$ + "HALB " end if ' ab 5 vor halb immer stunde = stunde + 1 hhx=hh if (mm >24) and (mm<60) then hhx = hh+1 if hhx = 13 then hhx = 1 end if end if '1 if hhx=1 then NEO.STRIP 40,45,R,G,B,1 t$ = t$ + "EINS " end if '2 if hhx=2 then NEO.STRIP 46,49,R,G,B,1 t$ = t$ + "ZWEI " end if '3 if hhx=3 then NEO.STRIP 50,53,R,G,B,1 t$ = t$ + "DREI " end if '4 if hhx=4 then NEO.STRIP 56,59,R,G,B,1 t$ = t$ + "VIER " end if '5 if hhx=5 then NEO.STRIP 60,63,R,G,B,1 t$ = t$ + "FUENF " end if '6 if hhx=6 then NEO.STRIP 65,69,R,G,B,1 t$ = t$ + "SECHS " end if '7 if hhx=7 then NEO.STRIP 70,75,R,G,B,1 t$ = t$ + "SIEBEN " end if '8 if hhx = 8 then NEO.STRIP 76,79,R,G,B,1 t$ = t$ + "ACHT " end if '9 if hhx = 9 then NEO.STRIP 80,83,R,G,B,1 t$ = t$ + "NEUN " end if '10 if hhx = 10 then NEO.STRIP 84,86,R,G,B,1 t$ = t$ + "ZEHN " end if '11 if hhx = 11 then NEO.STRIP 87,89,R,G,B,1 t$ = t$ + "ELF " end if '12 if hhx = 12 then NEO.STRIP 90,95,R,G,B,1 t$ = t$ + "ZWOELF " end if 'UHR: if mm <5 then 'bisher NEO.STRIP nur im RAM, nun mit refresh!! NEO.STRIP 96,99,R,G,B,0 t$ = t$ + "UHR " else 'bisher NEO.STRIP nur im RAM, nun mit refresh!! NEO.STRIP 96,99,RX,GX,BX,0 end if ZEIT_TEXT$ = t$ return ' ####################################################################### showtime_8x8: 'bis 4 nach: if (mm<5) then t$ = "genau " NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN NEO.STRIP 12,15,RX,GX,BX,1 'NACH NEO.STRIP 8,10,RX,GX,BX,1 'VOR NEO.STRIP 16,19,RX,GX,BX,0 'HALB goto STUNDEN end if 'FUNF nach: if (mm >4) and (mm<10) then t$ = "FUENF nach " NEO.STRIP 0, 3,R,G,B,1 'FUENF NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN NEO.STRIP 12,15,R,G,B,1 'NACH NEO.STRIP 8,10,RX,GX,BX,1 'VOR NEO.STRIP 16,19,RX,GX,BX,1 'HALB goto STUNDEN end if 'ZEHN nach: if (mm >9) and (mm<15) then t$ = "ZEHN nach " NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF NEO.STRIP 4, 7,R,G,B,1 'ZEHN NEO.STRIP 12,15,R,G,B,1 'NACH NEO.STRIP 8,10,RX,GX,BX,1 'VOR NEO.STRIP 16,19,RX,GX,BX,1 'HALB goto STUNDEN end if 'FUENFZEHN nach: if (mm >14) and (mm<20) then t$ = "FUENFZEHN nach " NEO.STRIP 0, 3,R,G,B,1 'FUENF NEO.STRIP 4, 7,R,G,B,1 'ZEHN NEO.STRIP 12,15,R,G,B,1 'NACH NEO.STRIP 8,10,RX,GX,BX,1 'VOR NEO.STRIP 16,19,RX,GX,BX,1 'HALB goto STUNDEN end if 'ZEHN vor HALB: if (mm >19) and (mm<25) then t$ = "ZEHN vor HALB " NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF NEO.STRIP 4, 7,R,G,B,1 'ZEHN NEO.STRIP 12,15,RX,GX,BX,1 'NACH NEO.STRIP 8,10,R,G,B,1 'VOR NEO.STRIP 16,19,R,G,B,1 'HALB goto STUNDEN end if 'FUENF vor HALB: if (mm >24) and (mm<30) then t$ = "FUENF vor HALB " NEO.STRIP 0, 3,R,G,B,1 'FUENF NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN NEO.STRIP 12,15,RX,GX,BX,1 'NACH NEO.STRIP 8,10,R,G,B,1 'VOR NEO.STRIP 16,19,R,G,B,1 'HALB goto STUNDEN end if 'HALB: if (mm >29) and (mm<35) then t$ = "HALB " NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN NEO.STRIP 12,15,RX,GX,BX,1 'NACH NEO.STRIP 8,10,RX,GX,BX,1 'VOR NEO.STRIP 16,19,R,G,B,1 'HALB goto STUNDEN end if 'FUENF nach HALB: if (mm >34) and (mm<40) then t$ = "FUENF nach HALB " NEO.STRIP 0, 3,R,G,B,1 'FUENF NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN NEO.STRIP 12,15,R,G,B,1 'NACH NEO.STRIP 8,10,RX,GX,BX,1 'VOR NEO.STRIP 16,19,R,G,B,1 'HALB goto STUNDEN end if 'ZEHN nach HALB: if (mm >39) and (mm<45) then t$ = "ZEHN nach HALB " NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF NEO.STRIP 4, 7,R,G,B,1 'ZEHN NEO.STRIP 12,15,R,G,B,1 'NACH NEO.STRIP 8,10,RX,GX,BX,1 'VOR NEO.STRIP 16,19,R,G,B,1 'HALB goto STUNDEN end if 'FUENFZEHN vor: if (mm >44) and (mm<50) then t$ = "FUENFZEHN vor " NEO.STRIP 0, 3,R,G,B,1 'FUENF NEO.STRIP 4, 7,R,G,B,1 'ZEHN NEO.STRIP 12,15,RX,GX,BX,1 'NACH NEO.STRIP 8,10,R,G,B,1 'VOR NEO.STRIP 16,19,RX,GX,BX,1 'HALB goto STUNDEN end if 'ZEHN vor : if (mm >49) and (mm<55) then t$ = "ZEHN vor " NEO.STRIP 0, 3,RX,GX,BX,1 'FUENF NEO.STRIP 4, 7,R,G,B,1 'ZEHN NEO.STRIP 12,15,RX,GX,BX,1 'NACH NEO.STRIP 8,10,R,G,B,1 'VOR NEO.STRIP 16,19,RX,GX,BX,1 'HALB goto STUNDEN end if 'FUENF vor : if (mm >54) and (mm<60) then t$ = "FUENF vor " NEO.STRIP 0, 3,R,G,B,1 'FUENF NEO.STRIP 4, 7,RX,GX,BX,1 'ZEHN NEO.STRIP 12,15,RX,GX,BX,1 'NACH NEO.STRIP 8,10,R,G,B,1 'VOR NEO.STRIP 16,19,RX,GX,BX,1 'HALB goto STUNDEN end if STUNDEN: ' ab 10 vor halb immer stunde = stunde + 1 hhx=hh if (mm >19) and (mm<60) then hhx = hh+1 if hhx = 13 then hhx = 1 end if end if NEO.STRIP 20,63,RX,GX,BX,1 '1 if hhx=1 then NEO.STRIP 24,27,R,G,B,1 NEO.STRIP 28,63,RX,GX,BX,0 t$ = t$ + "EINS " end if '2 if hhx=2 then NEO.STRIP 24,27,RX,GX,BX,1 NEO.STRIP 35,36,R,G,B,1 NEO.STRIP 45,46,R,G,B,0 t$ = t$ + "ZWEI " end if '3 if hhx=3 then NEO.STRIP 35,36,RX,GX,BX,1 NEO.STRIP 43,46,R,G,B,0 t$ = t$ + "DREI " end if '4 if hhx=4 then NEO.STRIP 20,23,R,G,B,1 NEO.STRIP 43,46,RX,GX,BX,0 t$ = t$ + "VIER " end if '5 if hhx=5 then NEO.STRIP 20,23,RX,GX,BX,1 NEO.PIXEL 39,R,G,B,1 NEO.PIXEL 47,R,G,B,1 NEO.PIXEL 55,R,G,B,1 NEO.PIXEL 63,R,G,B,0 t$ = t$ + "FUENF " end if '6 if hhx=6 then NEO.STRIP 27,31,R,G,B,1 NEO.STRIP 32,63,RX,GX,BX,0 t$ = t$ + "SECHS " end if '7 if hhx=7 then NEO.STRIP 32,34,R,G,B,1 NEO.STRIP 40,42,R,G,B,1 NEO.STRIP 27,31,RX,GX,BX,0 t$ = t$ + "SIEBEN " end if '8 if hhx = 8 then NEO.STRIP 56,59,R,G,B,1 NEO.STRIP 32,34,RX,GX,BX,1 NEO.STRIP 40,42,RX,GX,BX,0 t$ = t$ + "ACHT " end if '9 if hhx = 9 then NEO.STRIP 52,55,R,G,B,1 NEO.STRIP 56,59,RX,GX,BX,0 t$ = t$ + "NEUN " end if '10 if hhx = 10 then NEO.STRIP 48,51,R,G,B,1 NEO.STRIP 52,55,RX,GX,BX,0 t$ = t$ + "ZEHN " end if '11 if hhx = 11 then NEO.STRIP 61,63,R,G,B,1 NEO.STRIP 48,51,RX,GX,BX,0 t$ = t$ + "ELF " end if '12 if hhx = 12 then NEO.STRIP 35,39,R,G,B,1 NEO.STRIP 61,63,RX,GX,BX,0 t$ = t$ + "ZWOELF " end if ZEIT_TEXT$ = t$ return ' ######################################################################### WebInterface: cls autorefresh 1000 'wlog time$ a$="" a$ = a$ + "<h1>- - - W o r d C l o c k - - -</h1>" a$ = a$ + "<h5>############## "+ ver$ + " #####################</h5>" if IPADR$= "192.168.4.1" then a$ = a$ + |Die Uhr ist gerade NICHT in einem WLAN angemeldet<br><br>| a$ = a$ + |Evtl sind die Anmeldedaten falsch ...<br>| a$ = a$ + |oder die Entfernung zu dem WLAN-AP ist zu gross.<br><br>| a$ = a$ + |Bitte auf der <a href="./config">CONFIG-PAGE </a>| a$ = a$ + |oben bei StationMode<br> die WLAN-SSID und das Kennwort<br>| a$ = a$ + |eintragen bzw berichtigen.<br><br>| a$ = a$ + |<a href="./config">Weiter zur CONFIG-PAGE</a><br>| else a$ = a$ + textbox$(zeit$) + " - - - - " + TEXTBOX$(ZEIT_TEXT$) a$ = a$ + "<br><br>Farbe der aktiven Zeichen:<br>" a$ = a$ + SLIDER$(R,0,180,"cssSL")+ "R:" + TEXTBOX$(R) + "<br>" a$ = a$ + SLIDER$(G,0,180,"cssSL")+ "G:" + TEXTBOX$(G) + "<br>" a$ = a$ + SLIDER$(B,0,180,"cssSL")+ "B:" + TEXTBOX$(B) + "<br>" a$ = a$ + "Farbe des Hintergrunds:<br>" a$ = a$ + SLIDER$(RX,0,30,"cssSL") + "RX:" + TEXTBOX$(RX) + "<br>" a$ = a$ + SLIDER$(GX,0,30,"cssSL") + "GX:" + TEXTBOX$(GX) + "<br>" a$ = a$ + SLIDER$(BX,0,30,"cssSL") + "BX:" + TEXTBOX$(BX) + "<br>" a$ = a$ +"<br>" + LISTBOX$( MODUS$, "UHR,COLOR_DEMO,DEMO","cssLB")+ " = Betriebs-Modus" a$ = a$ +"<br>" + LISTBOX$( TYPUS$, "8x8,8x8+4,10x10","cssLB")+ " = Uhr-Hardware-Typ" a$ = a$ + "<br><br>" a$ = a$ + BUTTON$("EINSTELLUNGEN SICHERN", EINSTELLUNGEN_SCHREIBEN,"cssBT") IF WITH_MP3 then a$ = a$ + "<br><br>" a$ = a$ + "<h5>###### ZEITANSAGE / INTERNET-RADIO #######</h5>" a$ = a$ + "<> RADIO-Station ... " a$ = a$ + "Volume:" + TEXTBOX$(VOLUME) + "<br>" a$ = a$ + LISTBOX$( STATION$, "WDR5,DLF_NOVA,ROCKANTENNE,RADIO_AUS,ZEITANSAGE_1/1,ZEITANSAGE_1/4,ZEITANSAGE_STD","cssLB1") a$ = a$ + SLIDER$(VOLUME,0,100,"cssSL") end if end if a$ = a$ + "<h5>############## "+ ver$ + " #####################</h5>" a$ = a$ + cssid$("cssSL"," width:150px;height:2em; font-size:0.8em; ") a$ = a$ + cssid$("cssLB1"," width:150px;height:2em; font-size:0.8em; ") a$ = a$ + cssid$("cssLB"," width:150px;height:2em; font-size:1.0em; ") a$ = a$ + cssid$("cssBT"," width:320px;height:2em; font-size:1.0em; border-radius:1.1em; padding:.5em") html a$ a$="" return ' ############################################################## COLOR_DEMO: mm= 0 for yy= 0 to LED_SPALTEN for xx = 0 to LED_SPALTEN rr = 80 - 10 * xx gg = 10 * xx bb = 10 * yy NEO.PIXEL xx + LED_SPALTEN * yy,rr,gg,bb,1 NEO.PIXEL LED_end + 1 - (xx + LED_SPALTEN * yy),rr,gg,bb,0 next xx next yy for i = LED_end to 2 step -1 NEO.PIXEL i,rnd(100),rnd(100),rnd(100),1 NEO.PIXEL LED_end-i,rnd(100),rnd(100),rnd(100),0 next i for yy= 0 to LED_SPALTEN for xx = 0 to LED_SPALTEN bb = 80 - 10 * xx gg = 10 * xx rr = 10 * yy NEO.PIXEL xx + 8 * yy,rr,gg,bb,1 NEO.PIXEL LED_end + 1- (xx + 8 * yy),rr,gg,bb,0 next xx next yy for yy= LED_SPALTEN to 0 step -1 for xx = 0 to LED_SPALTEN rr = 80 - 10 * xx gg = 10 * xx bb = 10 * yy NEO.STRIP 0,LED_end,rr,gg,bb pause 100 next xx next yy for yy= 0 to LED_SPALTEN for xx = 0 to LED_SPALTEN rr = 80 - 10 * xx gg = 10 * xx bb = 10 * yy NEO.STRIP 0,LED_end,rr,gg,bb 'pause 100 next xx next yy NEO.STRIP 0,LED_end,RX,GX,BX return ' ####################################################################### ESP32_ESP8266: ' ??? IS IT ANNEX for ESP8266 OR ANNEX32 ??? ANNEX32 = instr(ucase$(bas.ver$),"ANNEX32") return ' ####################################################################### STARTWERTE: zeit$ = time$ VOLUME = 10 'Volume für MP3 VOLUME_ALT = 0 Station$ = "WDR5" Station_alt$= "xxx" IPADR$ = WORD$(IP$,1) TYPUS$ = "" TYPUS_alt$= "x" Settings$ = "" ZEIT_TEXT$ = "ES IST ..." ZEIT_TEXT_alt$= "" t$ = ZEIT_TEXT$ R = 0 G = 60 B = 50 R_alt = R + 1 G_alt = G B_alt = B RX = 5 GX = 5 BX = 5 RX_alt = RX GX_alt = GX BX_alt = BX MODUS$ = "UHR" mm = 1 mm_alt = 2 hh = 1 hh_alt = 2 ss = 1 mm_mod = 0 ON = 0 ' !!!!!!!!!!!!!!!!!!!!!!!!!! gosub EINSTELLUNGEN_LESEN return ' ############################################################## EINSTELLUNGEN_LESEN: if (file.exists("/Wordclock_settings") and file.exists("/Wordclock_VOLUME")) then SETTINGS$ = file.read$("/Wordclock_settings") R = val(file.read$("/Wordclock_R")) G = val(file.read$("/Wordclock_G")) B = val(file.read$("/Wordclock_B")) RX = val(file.read$("/Wordclock_RX")) GX = val(file.read$("/Wordclock_GX")) BX = val(file.read$("/Wordclock_BX")) IF ANNEX32 then STATION$ = file.read$("/Wordclock_STATION") IF ANNEX32 then VOLUME = val(file.read$("/Wordclock_VOLUME")) TYPUS$= file.read$("/Wordclock_TYPUS") endif if TYPUS$ = "" then TYPUS$ = "8x8" return ' ############################################################## EINSTELLUNGEN_SCHREIBEN: ' schreibt die Einstellungen in einzelne Dateien im Flash ZEIT_TEXT$ = "Werte schreiben" xxx$ = "Wordclock-Daten" file.save "/Wordclock_settings",xxx$ file.save "/Wordclock_TYPUS",TYPUS$ file.save "/Wordclock_R", str$(R) file.save "/Wordclock_G", str$(G) file.save "/Wordclock_B", str$(B) file.save "/Wordclock_RX", str$(RX) file.save "/Wordclock_GX", str$(GX) IF ANNEX32 then file.save "/Wordclock_STATION", STATION$ IF ANNEX32 then file.save "/Wordclock_VOLUME", str$(VOLUME) save_stat$ = "OK" ZEIT_TEXT$ = "Werte wurden gesichert" return ' ############################################################## ShowIPADR: IPADR$ = WORD$(IP$,1) RR=R:GG=G:BB=B if (ANNEX32 and with_MP3) then 'AUF ESP32 MIT SOUND PLAY.VOLUME VOLUME 'play.speak "The I P AdRESS IS " + IPADR$ play.voice "DIE Netzwerk-ADRESSE IST nun " + IPADR$, "de" i=-1 while PLAY.ISPLAYING i=i+5 NEO.STRIP 0,i,0,15,0 pause 400 wend else 'AUF ESP8266 OHNE SOUND 'einzelne stellen der IP-Adresse als Stundenwert anzeigen ' 0 = 10 ' Punkt = Anzeige komplett GRUEN ' NEO.STRIP 0,LED_end + (m_LED *4),50,0,0 pause 900 NEO.STRIP 0,LED_end + (m_LED *4),0,0,0 ii=1 R=80:G=50:B=0 pp=0 for i = 1 to len(IPADR$) ZEIT_TEXT$ =mid$(IPADR$,i,1) if ZEIT_TEXT$ = "." then pp =pp + 1 NEO.STRIP 0,LED_end,0,40,0 pause 400 if pp=3 then R=0 G=100 B=0 endif else mm=0 hh=val(ZEIT_TEXT$) if hh=0 then hh= 10 end if gosub showtime end if pause 1000 NEO.STRIP 0,LED_end,RX,GX,BX 'neo.cls() next i end if NEO.STRIP 0,LED_end,0,40,40 pause 2000 NEO.STRIP 0,LED_end,RX,GX,BX R=RR:G=GG:B=BB return ' ############################################################## HW_TYPUS: IF DAC_extern then play.setup 1,8 'Sound with EXTERNAL DAC at Pin 26/2/5 and maximized buffer size IF not DAC_extern then play.setup 0,8 'Sound with internal DAC at Pin 25/26 'Hardwaretyp der Uhr if (TYPUS$ = "8x8") or (TYPUS$ = "8x8+4") or (TYPUS$ = "") then '8*8-MATRIX-Uhr '############### LED_start = 0 LED_end = 63 LED_SPALTEN = 7 '= LED Anzahl pro Zeile minus 1!!!!! LED_blink = 0 m_LED = 0 ' 0 zusaetzliche Minuten-LEDs vorhanden = 0 end if if TYPUS$ = "8x8+4" then m_LED = 1 ' 4 zusaetzliche Minuten-LEDs vorhanden = 1 end if if TYPUS$ = "10x10" then '10*10-MATRIX-Uhr '############### LED_start = 0 LED_end = 99 LED_SPALTEN = 9 '= LED Anzahl pro Zeile minus 1!!!!! LED_blink = 54 m_LED = 0 ' 0 zusaetzliche Minuten-LEDs vorhanden = 0 end if return ' ############################################################### NEO_SETUP: ' !!!!!!!!!!! NEOPIXEL geht auf ESP8266 nur noch an GPIO02=D4 !!!!!!!!!!!!!!! 'Anzahl der LEDs incl Minuten-LED 'neo.setup LED_end + (m_LED * 4) 'für ESP8266 if ANNEX32 then PIN_NEO = 12 'für WordClock mir ESP32 und externem Soundchip neo.setup PIN_NEO, LED_end + (m_LED * 4) ' Für ESP32 !!!!!!!!!!!!!!!!!! else PIN_NEO = 02 'für WordClock mir ESP8266 neo.setup LED_end + (m_LED * 4) ' Für ESP8266 end if for I= 0 to LED_end neo.pixel I, rnd(10), rnd(10), rnd(10) next i return ' ############################################################## ' ############################################################## INTERNET_RADIO: IF DAC_extern then play.setup 1,8 'Sound with EXTERNAL DAC at Pin 26/2/5 and maximized buffer size IF not DAC_extern then play.setup 0,8 'Sound with internal DAC at Pin 25/26 play.volume VOLUME IF STATION$ = "RADIO_AUS" THEN play.stop 'IF STATION$ = "RADIO_AUS" THEN play.speak "The RADIO is switched OFF, now." IF STATION$ = "RADIO_AUS" THEN play.voice "Das RADIO ist nun ausgeschaltet.","de" IF STATION$ = "ROCKANTENNE" THEN play.networks "http://195.30.109.53/rockantenne/stream/mp3" IF STATION$ = "WDR5" THEN play.networks "http://wdr-edge-10b6-fra-dtag-cdn.cast.addradio.de/wdr/wdr5/live/mp3/128/stream.mp3" IF STATION$ = "DLF_NOVA" THEN play.networks "http://dradio-edge-10c8-fra-dtag-cdn.cast.addradio.de/dradio/nova/live/mp3/128/stream.mp3" IF STATION$ = "ZEITANSAGE_1/1" THEN Play.stop IF STATION$ = "ZEITANSAGE_1/4" THEN Play.stop IF STATION$ = "ZEITANSAGE_STD" THEN Play.stop hh_alt= -1 : ZEIT_TEXT_ALT$ = "" ' damit die Zeit direkt einmal angesagt wird, sobald die Ansage aktiviert wird return
PeterN 5 years ago
Even MP3-Streaming of Internetradio is a matter of one command-line..
So it was easy to extend the software for the Wordclocks:
- Speak the time via external I2S-Sound-DAC or internal DAC in different ways
- Play some internet radio stations .
- Speak the moduls IP-Address at startup
ANNEX-BASIC-Code for talking WordClock with ESP8266 or ESP32 :
Please see attached file
PeterN 5 years ago
img-4470.JPG (561kb)
img-4471.JPG (543kb)
img-4481.jpg (538kb)
img-4482.jpg (536kb)
img-4488.JPG (840kb)
img-4490.JPG (791kb)
img-4491.JPG (620kb)
img-4494.JPG (632kb)
img-4496.JPG (584kb)
img-4508.JPG (788kb)
img-4509.JPG (493kb)
img-5602.JPG (2120kb)
img-5633.JPG (1403kb)
img-5791.JPG (1876kb)
img-5797.JPG (1484kb)