General area when it fits no where else

Moderator: Mmiscool

User avatar
By forlotto
#34834
Code: Select allcls
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 allcls



    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...
User avatar
By forlotto
#35026 still having trouble the pin status never changes even when MyReturnMsg...

Once pin status is read it appears it is fixed as that value

A very amusing thing to get this figured out how to display a constant refreshed status. I thought about the wprint htmlvar (var). Semi confused as to how this is going to help any...

Why is it with LUA for instance I can read pins even if they are set as outputs what is the difference between basic and LUA if any that gives it the ability to do such a thing when set as an output... Is this why LUA makes you set outputs to make this possible?

MyReturnMsg seems to look like connection send (buf) for instance but it does not quite allow the same things such as variables connotation etc ...

I stored the variables in OL1 - OL8 and tried to see the change that way as well still everything is static on the read and does not change although I get confirmation that it has changed...

A strange deal to me I'll keep chipping away at it but I am curious if you are able to see the status change if you after changing a pin?