need help just cant get a constant status update page w/url
Posted: Mon Nov 23, 2015 11:41 pm
Code: Select all
cls
if io(pi,D1) = 1 then wprint "<p>OUTPUT_1 is OFF</p>" else wprint "<p>OUTPUT_1 is ON</p>"
if io(pi,D2) = 1 then wprint "<p>OUTPUT_2 is OFF</p>" else wprint "<p>OUTPUT_2 is ON</p>"
if io(pi,D5) = 1 then wprint "<p>OUTPUT_3 is OFF</p>" else wprint "<p>OUTPUT_3 is ON</p>"
if io(pi,D6) = 1 then wprint "<p>OUTPUT_4 is OFF</p>" else wprint "<p>OUTPUT_4 is ON</p>"
if io(pi,D7) = 1 then wprint "<p>OUTPUT_5 is OFF</p>" else wprint "<p>OUTPUT_5 is ON</p>"
if io(pi,D8) = 1 then wprint "<p>OUTPUT_6 is OFF</p>" else wprint "<p>OUTPUT_6 is ON</p>"
if io(pi,RX) = 1 then wprint "<p>OUTPUT_7 is OFF</p>" else wprint "<p>OUTPUT_7 is ON</p>"
if io(pi,TX) = 1 then wprint "<p>OUTPUT_8 is OFF</p>" else wprint "<p>OUTPUT_8 is ON</p>"
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"
msgget "pin" pinNo
msgget "stat" pinStatus
msgget "action" pinAction
if pinAction == "po" then gosub [po.pin]
print "DOne with retrn code"
msgreturn MyReturnMsg
wait
[po.pin]
po pinNo pinStatus
MyReturnMsg = "Pin Is Set"
return
what I want is a status page to be shown for GPIO status that is constantly updated as the page is refreshed and then the ability to turn pins on and off from the web page
I am just not understanding what I am doing incorrectly didn't want to ask for help wanted to stick to brute force but at this point you got me how to accomplish this it is like once it reads the values the values are stuck and never change etc...
I am sure I am missing something simple
tried this too.
Code: Select all
cls
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"
msgget "pin" pinNo
msgget "stat" pinStatus
msgget "action" pinAction
if pinAction == "po" then gosub [po.pin]
if pinAction == "ri" then gosub [read.it]
print "DOne with retrn code"
msgreturn MyReturnMsg
wait
[po.pin]
po pinNo pinStatus
MyReturnMsg = "Pin Is Set"
return
[read.it]
cls
if io(pi,D1) = 1 then wprint "<p>OUTPUT_1 is OFF</p>" else wprint "<p>OUTPUT_1 is ON</p>"
if io(pi,D2) = 1 then wprint "<p>OUTPUT_2 is OFF</p>" else wprint "<p>OUTPUT_2 is ON</p>"
if io(pi,D5) = 1 then wprint "<p>OUTPUT_3 is OFF</p>" else wprint "<p>OUTPUT_3 is ON</p>"
if io(pi,D6) = 1 then wprint "<p>OUTPUT_4 is OFF</p>" else wprint "<p>OUTPUT_4 is ON</p>"
if io(pi,D7) = 1 then wprint "<p>OUTPUT_5 is OFF</p>" else wprint "<p>OUTPUT_5 is ON</p>"
if io(pi,D8) = 1 then wprint "<p>OUTPUT_6 is OFF</p>" else wprint "<p>OUTPUT_6 is ON</p>"
if io(pi,RX) = 1 then wprint "<p>OUTPUT_7 is OFF</p>" else wprint "<p>OUTPUT_7 is ON</p>"
if io(pi,TX) = 1 then wprint "<p>OUTPUT_8 is OFF</p>" else wprint "<p>OUTPUT_8 is ON</p>"
return
And a lot of other things I would care not to add...
Either the status of the pin is not changing or the read status is staying fixed hard to tell really without anything hooked to it I would have to use the led on board to test at this time which I have not done...