Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By luc VdV
#37828 ' define outputpin
let OutputPinNo = 0
' define initial state. Led is connected to+V so 1 means led=off
let OutputPinState = 1
' update the output and build the web-page
gosub [Update]
wait
[ImgClicked]
if OutputPinState = 0 then goto [SwitchTo1]
OutputPinState = 0
goto [ImgClickedExit]
[SwitchTo1]
OutputPinState = 1
[ImgClickedExit]
gosub [Update]
wait
[Update]
po OutputPinNo OutputPinState
cls
wprint "Created with ESP8266 Basic V1.71<br>"
if OutputPinState = 0 then goto [OutputIsLow]
imagebutton lamp_off.png [ImgClicked]
goto [UpdateExit]
[OutputIsLow]
imagebutton lamp_on.png [ImgClicked]
[UpdateExit]
button "exit" [Exit]
return
[Exit]
end


That's all it takes. Don't forget to upload 2 pictures. :)
Connect a SMD-relay instead of a led to drive large loads.
You do not have the required permissions to view the files attached to this post.
User avatar
By forlotto
#37939
Code: Select all' define outputpin
let OutputPinNo = 0
' define initial state. Led is connected to+V so 1 means led=off
let OutputPinState = 1
' update the output and build the web-page
gosub [Update]
wait
[ImgClicked]
if OutputPinState = 0 then goto [SwitchTo1]
OutputPinState = 0
goto [ImgClickedExit]
[SwitchTo1]
OutputPinState = 1
[ImgClickedExit]
gosub [Update]
wait
[Update]
po OutputPinNo OutputPinState
cls
wprint "Created with ESP8266 Basic V1.71<br>"
if OutputPinState = 0 then goto [OutputIsLow]
imagebutton lamp_off.png [ImgClicked]
goto [UpdateExit]
[OutputIsLow]
imagebutton lamp_on.png [ImgClicked]
[UpdateExit]
button "exit" [Exit]
return
[Exit]
end


Well done picture buttons I like it ;)

Have you tested clicking this on and off say 30 times as quickly as possible without stopping to see if the ESP8266 hangs up and resets?

Kind of curious to see what happens thanks!
User avatar
By Mmiscool
#38008 This is a nifty example. Would be nice to get some of these examples up on http://www.instructables.com/
User avatar
By luc VdV
#38050
forlotto wrote:Have you tested clicking this on and off say 30 times as quickly as possible without stopping to see if the ESP8266 hangs up and resets?
Kind of curious to see what happens thanks!


Have tested it +/-100 times as fast as I can click. Output reacts as it should. Html can't refresh fast enough but once I stop clicking, it refreshes 2 or 3 times and it shows the exact image.
No crashes or hangups noticed BUT......
it seems this is only working with google-chrome browser. Tested it also with IE explorer and firefox. They do not work.... :?
It seems (for as far as I can understand html) the image-type has no property 'value'.
to be continued ....