Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By matherp
#33116 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

Code: Select allmemclear
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
User avatar
By viscomjim
#33121 Awesome Peter! Thanks for your help with this. Having never really used html, your examples are opening the eyes and now having to look up html syntax is helping the old noggin learn new things. PLEASE keep up the examples. It makes things clearer for the noobs like me.

Also a BIG THANKS to Mike for this! Its a BASIC lovers dream come true!!!!!
User avatar
By Mmiscool
#33193 These are great examples. I really do like working with matherp as he has been able to get the i2c working. Would still like to make some improvements and better documentation perhaps with his help if he is willing.

Basic for the web how ever is not exactly a new thing. I have been using "Run Basic" from http://www.runbasic.com/ for years and it is quite an excellent basic for writing we applications. Been using that a lot for my inspiration.
User avatar
By viscomjim
#33212 The coolness factor here is the fact that us BASIC folk can finally feel that, because of people like Mike, and now Peter, can finally control hardware at the "microcontroller" level. Turning on and off a couple of gpio pins, using the internet and my phone or tablet, was not really in reach without having to learn and ingest so much new information that for me was not easily understandable. When Geoff Graham developed the Maximite and then, when I got completely hooked, the micromite, I can tell you that I know that I am not the only one that was able to get "back in the game". And trust me, I have.

Can't wait to take full advantage of what Mike has created. Call me a "fanboy". I really don't mind.