I/O monitor with auto refresh and display update
Posted: Thu Nov 05, 2015 7:23 am
This code reads the I/O ports every second and displays them in a table. It uses an auto-refresh command in the html to update the browser every 5 seconds.
It is essential that you press the exit button to terminate the program. Otherwise the timer is left running and then it is difficult to access the ESP8266 Basic Interpreter windows
It is essential that you press the exit button to terminate the program. Otherwise the timer is left running and then it is difficult to access the ESP8266 Basic Interpreter windows
Code: Select all
memclear
timer 1000 [branch]
cls
wprint "<head>"
wprint "<meta http-equiv='refresh' content='5'>"
wprint "</head>"
gosub readdata
wprint "<table border='1'>"
wprint "<tr>"
wprint "<td>"
wprint "ADC"
wprint "</td>"
wprint "<td>"
wprint htmlvar(ADCin)
wprint "</td>"
wprint "</tr>"
wprint "<tr>"
wprint "<td>"
wprint "GPIO0"
wprint "</td>"
wprint "<td>"
wprint htmlvar(PIO0)
wprint "</td>"
wprint "</tr>"
wprint "<tr>"
wprint "<td>"
wprint "GPIO2"
wprint "</td>"
wprint "<td>"
wprint htmlvar(PIO2)
wprint "</td>"
wprint "</tr>"
wprint "<tr>"
wprint "</table>"
wprint <p>
button Exit [TestExit]
wait
[TestExit]
timer 0
end
[branch]
gosub readdata
wait
readdata
ai ADCin 'update variable with latest analog in
pi 0 PIO0
pi 2 PIO2
return