Post about your Basic project here

Moderator: Mmiscool

User avatar
By heckler
#63607 Russm,

I must compliment you on your OUTSTANDING coding!
I just loaded it up on a nodemcu module and ran it and I am in awe!

I love to see examples like this to see how to implement various methods like html, cssid, htmlvar, etc, etc.

If you are willing it would be awesome to do a youtube video where you walk down through the code and explain what each part does so others can learn and see how POWERFUL mike's espbasic really is.

Or even just a written tutorial or anything.
It is detail like that that is missing from the doc's
Mike has given me access to the docs to add examples and detail but I would be guessing at some of what you have done in your code.

your thoughts
regards
dwight
User avatar
By russm
#63620 I put a lot of comments in the code which can cause problems as the program is rather large with them in cluded :) Also i should upload the calibration program I made to allow for easier initial setup. It is easier than uncommenting and setting various hour/min/sec values in the main program. It's possible to directly set the values and not add fractions to hours and minutes. I'll find that code and upload too. It uses some simple html value entry.

For DST info, I use the DST value that is in the system but set its value it myself (during initial time/network setup by the user). The DST detection code will ONLY operate on the DST change day/hour. If your clock is not plugged in it will not be able to figure it out later. I started to write this but...

FWIW, the clock has been running continuously for a very long time, on power outages (it's not plugged into a UPS) it comes right up and works again. It's running an older version of ESP basic 3 V58 right now. Haven't had a chance to do much lately but hope to soon.

russ
User avatar
By russm
#63622 Here's the calibrate.bas program. Also, I uploaded the latest firmware (.68) and the main program seems to work fine. Still a bit unstable if I go into edit but I think that is due to the size of the program, even with comments removed.

russ

Code: Select all'********************************************************
'* Calibrate Analog Panel Meter Clock                   *
'*   by Russ McIntire, 9/9/16                           *
'*   D0 = Hours                                         *
'*   D1 = Minutes                                       *
'*   D2 = Seconds                                       *
'*                                                      *
'* Set Hour, Minute, Second to calibrate panel meters   *
'********************************************************

memclear

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..."


'GUI setup
cls
wprint |<HTML>|
wprint |<HEAD>|
wprint |<style> h1{text-shadow: 2px 2px 5px blue} </style>|
wprint |<h1>Analog Clock Setup</h1>|
wprint |</HEAD>|
wprint "Calibration"

wprint "<br><br>"
textbox hour
cssid htmlid(),"position: absolute; left: 130px; display:block;width:40px"
wprint "Hour(0-12,12=0): "
wprint "<br>"
textbox min
cssid htmlid(),"position: absolute; left: 130px; display:block;width:40px"
wprint "Minute(0-59):"
wprint "<br>"
textbox sec
cssid htmlid(),"position: absolute; left: 130px; display:block;width:40px"
wprint "Second(0-59):"
wprint "<br><br>"
button "Show Time", [show_time]
wprint "<br><br>"


wprint "<br> <br>"
button "Reboot Clock", [reboot_clock]
wprint "<br><br>"
wprint htmlvar(uvsr)
wprint "<br><br>"


timer 5000, [show_time]
wait
end

[show_time]
'Get time values from NTP server
 'hour = val(time("hour"))
 'min = val(time("min"))
 'sec = val(time("sec"))