https://youtu.be/ylGcGyvTE-c
I give up, can't make youtube in-line work to show the video...
Explore... Chat... Share...
Moderator: Mmiscool
'******************************************************
'* Analog Panel Meter Clock *
'* by Russ McIntire, 8/27/16 *
'* D0 = Hours *
'* D1 = Minutes *
'* D2 = Seconds *
'* *
'* To do: HTML setup screen to select DST, TZ, SSID *
'******************************************************
timesetup(-4,1) 'Need to figure out what is wrong with DST
delay 5000
udpbegin 5001
hour = 0
min = 0
sec = 0
M = " "
udptimer = 0
hourpwm = 0
minpwm = 0
secpwm = 0
'Determine broadcast address
let localIP = ip()
pos = instrrev(localIP,".")
netIP = left(localIP,pos)
nodeIP = mid(localIP,pos+1)
let broadcastaddr = netIP & "255"
timer 1000, [updatetime]
wait
end
[updatetime]
'Get time values from NTP server
hour = val(time("hour"))
min = val(time("min"))
sec = val(time("sec"))
'Set 12 hour time and determine AM/PM
if hour > 12 then
hour = hour - 12
M = "PM"
else
if hour = 0 then
hour = 12
endif
M = "AM"
endif
'Panel PWM calculation
'hourpwm = 85.33 * (hour) 'divide 1024/12
hourpwm = (85.33 * hour) + (1.55 * min) 'divide 1024/12 add proportion of minutes (~1.5/min)
minpwm = 17.36 * min 'divide 1024/59
'minpwm = (17.36 * min) + (.29 * sec) '- don't recommend - divide 1024/59 add proportion of seconds (.29/sec)
secpwm = 17.36 * sec 'divide 1024/59
'Panel output
io(pwo,d0,hourpwm)
io(pwo,d1,minpwm)
io(pwo,d2,secpwm)
'Daily NTP refresh at 2:00 AM
if ((hour=2) and (min=0) and (sec>0) and (sec<5) and (M="AM")) then
timesetup(-4,1) 'Need to figure out what is wrong with DST
delay 5000
endif
'Send UDP broadcast message out for current time every 30 seconds
udptimer = udptimer + 1
if udptimer > 30 then
ct = str(hour)&":"&time("min:sec")&" "&M
udpwrite broadcastaddr, 5001, ct
udptimer = 0
endif
wait
'*******************************************************
'* Analog Panel Meter Clock *
'* by Russ McIntire, 8/29/16 *
'* D0 = Hours *
'* D1 = Minutes *
'* D2 = Seconds *
'* *
'* Shows hours/minutes/seconds on 3 panel displays *
'* Allows Timezone and DST settings from webpage *
'* Requires Internet connection for NTP time retrieval *
'* Sends UDP broadcast of current time via UDP *
'* Can update UDP Port in settings, default is 5001 *
'*******************************************************
memclear
'Get DST and Timezone info from memory
DST = read.val(DaylightSavings)
timezone = read.val(TZ)
udpportval = read.val(UdpPort)
if DST = 1 then
tz = timezone + 1
else
tz = timezone
endif
if udpportval = 0 then udpportval = 5001
udpbegin udpportval
timesetup(tz,DST)
delay 5000
hour = 0
min = 0
sec = 0
M = " "
udptimer = 0
hourpwm = 0
minpwm = 0
secpwm = 0
updated = 0
updatetimer = 0
cts = time("hour:min:sec")
uvsr = "Running..."
'Determine broadcast address
let localIP = ip()
pos = instrrev(localIP,".")
netIP = left(localIP,pos)
nodeIP = mid(localIP,pos+1)
let broadcastaddr = netIP & "255"
'GUI setup
cls
wprint |<HTML>|
wprint |<HEAD>|
'wprint |<meta http-equiv='refresh'content='5;URL=/input?'>|
wprint |<h2>Analog Clock Setup Info</h2>|
wprint |</HEAD>|
'wprint |<body bgcolor="grey">|
wprint "<br>"
wprint "The time is currently: "
wprint htmlvar(cts) ' time("hour:min:sec")
wprint "<br>"
wprint "Timezone: "
textbox timezone
wprint "<br>"
wprint "DST: "
textbox DST
wprint "<br>"
button "Time Info Update", [timezone_update]
wprint "<br> <br>"
wprint "UDP Port: "
textbox udpportval
wprint "<br>"
button "UDPPort Update", [udpport_update]
wprint "<br> <br>"
wprint htmlvar(uvsr)
timer 1000, [updatetime]
wait
end
[updatetime]
'Get time values from NTP server
hour = val(time("hour"))
min = val(time("min"))
sec = val(time("sec"))
cts = time("hour:min:sec")
'Set 12 hour time and determine AM/PM
if hour > 12 then
hour = hour - 12
M = "PM"
else
if hour = 0 then
hour = 12
endif
M = "AM"
endif
'Panel PWM calculation
'hourpwm = 85.33 * (hour) 'divide 1024/12
hourpwm = (85.33 * hour) + (1.55 * min) 'divide 1024/12 add proportion of minutes (~1.5/min)
minpwm = 17.36 * min 'divide 1024/59
'minpwm = (17.36 * min) + (.29 * sec) '- don't recommend - divide 1024/59 add proportion of seconds (.29/sec)
secpwm = 17.36 * sec 'divide 1024/59
'Panel output
io(pwo,d0,hourpwm)
io(pwo,d1,minpwm)
io(pwo,d2,secpwm)
'Daily NTP refresh at 2:00 AM
if ((hour=2) and (min=0) and (sec>0) and (sec<5) and (M="AM")) then
timesetup(tz,DST) 'Need to figure out what is wrong with DST
delay 5000
endif
gosub [udptimer]
wait
[timezone_update]
'Persist timezone information and UDPPort
write(DaylightSavings,str(DST))
write(TZ,str(timezone))
if DST = 1 then
tz = timezone + 1
else
tz = timezone
endif
timesetup(tz,DST)
delay 5000
'serialprintln "Timezone Updated"
'serialprintln "The Updated time is: "
'serialprintln time("hour:min")
cts = time("hour:min:sec")
uvsr = "<mark> Updated... </mark>"
updated = 1
returngui
wait
[udpport_update]
write(UdpPort,str(udpportval))
udpbegin udpportval
cts = time("hour:min:sec")
uvsr = "<mark> Updated... </mark>"
updated = 1
returngui
wait
[udptimer]
'Send UDP broadcast message out for current time every 30 seconds
udptimer = udptimer + 1
if udptimer > 30 then
ct = str(hour)&":"&time("min:sec")&" "&M
udpwrite broadcastaddr, 5001, ct
udptimer = 0
endif
'Check to see if Timezone or DST was updated
if updated = 1 then
updatetimer = updatetimer + 1
if updatetimer > 6 then
uvsr = "Running..."
updated = 0
updatetimer = 0
returngui
endif
endif
return
It takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]