Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By timathis
#32143 I would like to see an example of how to use the msg command to set up a webpage and communicate status of a button.
Having trouble seeing how to integrate several snippet examples into a larger program.
User avatar
By Mmiscool
#32158 Please note that the below will work with the latest build. Did some bug fixing today.
Download the latest.

The /msg url is not intended to do all that fancy GUI stuff even though it can be used to do so with some clever hackery.

It is intended to do simple interactions with the device.

You can use it in conjunction with a command line script running on your pc.

For example
on your pc you create a bat file for shell script. If you are on windows you can download wget from the following site. If on linux you are all set already. https://eternallybored.org/misc/wget/

The code here will allow for arbitrary io control and reading.
Bat file or shell script:
Code: Select allwget "http://172.16.0.184/msg?pin=2&stat=1&action=po" -q -O -



On the esp you would use the following code.
Code: Select allmsgbranch [mybranch]
print "You can send msgs to the esp and do things based on accessing a URL"
wait
[mybranch]
MyReturnMsg = "Not a valid msg received"
msgget "pin" pinNo
msgget "stat" pinStatus
msgget "action" pinAction
if pinAction == "po" then gosub [po.pin]
if pinAction == "pi" then gosub [pi.pin]
if pinAction == "pwo" then gosub [pwo.pin]
if pinAction == "pwi" then gosub [pwi.pin]
if pinAction == "ai" then gosub [ai.pin]
print "DOne with retrn code"
msgreturn MyReturnMsg
wait

[po.pin]
po pinNo pinStatus
MyReturnMsg = "good"
return

[pi.pin]
pi pinNo MyReturnMsg
return

[pwo.pin]
pwo pinNo pinStatus
MyReturnMsg = "good"
return

[pi.pin]
pwi pinNo MyReturnMsg
return

[ai.pin]
ai MyReturnMsg
return
User avatar
By timathis
#32162 Thanks for the info.
Will download latest version and play around with it some.
I am kind of amazed that you have so few bug reports(basically none!!)

Timathis
User avatar
By Mmiscool
#32201 I just uploaded a new version. Try it out and tell me if it works for you.