Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By flywire
#61549
matherp wrote:... 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 ...

Really? There must be a better way of doing this.
User avatar
By heckler
#61590 Flywire,
It seems reasonable to me... if you have a program running that is using a timer then how can you expect the module to also update and allow you to interact with the programming gui to modify the code??

I would think stopping or "exit" you code to make changes would be normal and expected requirement.
what is your thinking??

dwight
User avatar
By flywire
#61594
heckler wrote:... what is your thinking??

Maybe there are features in the language now that handle this situation more gracefully. I'd expect an opportunity to terminate the code, say Ctrl C, Ctrl Break or something. Perhaps use interrupts. Runaway code seems unreasonable to me.
User avatar
By dziloo@wp.pl
#62739 I updated Code for 3.0 Branch Alpha. Working perfectly!
For a simple test: After starting the program, press and hold the flash button in the NodeMCU board.
The Status pin GPIO0 will change from 1 to 0.

Refresh page changed to 15 seconds... You can manually change this value in the code.

Code: Select all' ### Working Update for Branch 3,0 Alpha ###
'memclear ' ## Maybe not necessary...
timer 1000, [branch] ' ## Time for auto refresh variables ##
cls
wprint "<head>"
wprint "<meta http-equiv='refresh' content='15'>" '#### Time for automatic refresh page ###
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>"
wprint "It will Stopped Timer and END Program ==> "
button End, [TestExit]
print "Otherwise the timer is left running and then it is difficult to access the ESP8266 Basic Interpreter window"
wait

[TestExit]
timer 0
end


[branch]
gosub [readdata]
wait

[readdata]
ADCin = io(ai)     'update variable with latest analog in
PIO0 = io(pi , 0) ' PIO0
PIO2 = io(pi , 2) ' PIO2
return