MSG URL (Advanced) (3.0 branch only)
This is a universal program that will allow for arbitrary I/O pin input and output. It will allow you to us your browser or shell on a PC to control any I/O pin on the device and query a pins input status.
On your pc you create a bat file for shell script.
If you are on windows you can download wget from the following site.
https://eternallybored.org/misc/wget/ or from the link below.
On your pc you create a bat file for shell script.
If you are on windows you can download wget from the following site.
https://eternallybored.org/misc/wget/ or from the link below.
![]()
|
If on linux you are all set already.
The code here will allow for arbitrary io control and reading. If you are connected to your your esp through a router change the IP in the example below to that of the ESP8266 module. |
BAT FILE OR SHELL SCRIPT:
wget "http://192.168.4.1/msg?pin=2&stat=1&action=po" -q -O -
BASIC CODE:
msgbranch [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"
pinNo = val(msgget("pin"))
pinStatus = val(msgget("stat"))
pinAction = msgget("action")
if pinAction == "po" then
io(po,pinNo,pinStatus)
MyReturnMsg = "good"
end if
if pinAction == "pi" then
MyReturnMsg = io(pi,pinNo)
end if
if pinAction == "pwo" then
io(pwo,pinNo,pinStatus)
MyReturnMsg = "good"
end if
if pinAction == "pwi" then
MyReturnMsg = io(pwi,pinNo)
end if
if pinAction == "ai" then
MyReturnMsg = io(ai)
end if
print "DOne with retrn code"
msgreturn MyReturnMsg
wait
print "You can send msgs to the esp and do things based on accessing a URL"
wait
[mybranch]
MyReturnMsg = "Not a valid msg received"
pinNo = val(msgget("pin"))
pinStatus = val(msgget("stat"))
pinAction = msgget("action")
if pinAction == "po" then
io(po,pinNo,pinStatus)
MyReturnMsg = "good"
end if
if pinAction == "pi" then
MyReturnMsg = io(pi,pinNo)
end if
if pinAction == "pwo" then
io(pwo,pinNo,pinStatus)
MyReturnMsg = "good"
end if
if pinAction == "pwi" then
MyReturnMsg = io(pwi,pinNo)
end if
if pinAction == "ai" then
MyReturnMsg = io(ai)
end if
print "DOne with retrn code"
msgreturn MyReturnMsg
wait