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

Moderator: Mmiscool

User avatar
By forlotto
#35223 No...

This is the same thing it does not work it gets fixed at high and never changes even if the status changes to low.


Few other bugs I would like to mention:

1. Forum is stuck on stupid MMISCOOL's Basic Interpreter link is dead SQL error (I may have used up all your bandwidth lol!)
2. Documentation for onload is incorrect following your syntax for documentation it states the following.
Onload {routine} so according yo your syntax for the documentation people would understand this as: Onload routine.
Onload [{routine}] would be the correct way to document it then this way it'd look like Onload [routine]

Here is the code I am using:
Code: Select allONLOAD [testpins]
wprint htmlvar(statusofpin)


[testpins]
if io(pi,D3) = 1 then statusofpin = "<p>Pin high</p>" else statusofpin = "<p>pin low</p>"
    msgbranch [mybranch]
    wprint "SEVER STATUS 200 OK"


    [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 == "s" then gosub [read.it]
    print "DOne with retrn code"
    msgreturn MyReturnMsg
    wait

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


Things to note for the device:
1. I need to have a readout of all pins dynamic like the vars page.
2. I need to handle the output turning them off and on via url.

This is all I need to accomplish I have tried every angel nearly to accomplish this.
Last edited by forlotto on Sun May 29, 2016 3:12 am, edited 1 time in total.
User avatar
By Mmiscool
#35248 This looks like it should work for what you re trying to do.
Code: Select all    msgbranch [mybranch]
    print "SEVER STATUS 200 OK"
debugoff
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 == "s" then gosub [read.it]
    print "DOne with retrn code"
    msgreturn MyReturnMsg
    wait

    [po.pin]
po pinNo pinStatus
if pinNo == "D1" then D2S = pinStatus
if pinNo == "D2" then D2S = pinStatus
if pinNo == "D3" then D3S = pinStatus
if pinNo == "D4" then D4S = pinStatus
if pinNo == "D5" then D5S = pinStatus
if pinNo == "D6" then D6S = pinStatus
if pinNo == "D7" then D7S = pinStatus
if pinNo == "D8" then D8S = pinStatus

MyReturnMsg = ""
'io(po,pinNO,pinStatus)
if pinStatus = 1 then MyReturnMsg = MyReturnMsg & "Outlet was turned ON successfully" else MyReturnMsg = MyReturnMsg & "Outlet was turned OFF successfully"
return

[read.it]
MyReturnMsg = ""
if D1S = 1 then MyReturnMsg = MyReturnMsg & "<p>OUTLET_1 is OFF</p>" else MyReturnMsg = MyReturnMsg & "<p>OUTLET_1 is ON</p>"
if D2S = 1 then MyReturnMsg = MyReturnMsg & "<p>OUTLET_2 is OFF</p>" else MyReturnMsg = MyReturnMsg & "<p>OUTLET_2 is ON</p>"
if D3S = 1 then MyReturnMsg = MyReturnMsg & "<p>OUTLET_3 is OFF</p>" else MyReturnMsg = MyReturnMsg & "<p>OUTLET_3 is ON</p>"
if D4S = 1 then MyReturnMsg = MyReturnMsg & "<p>OUTLET_4 is OFF</p>" else MyReturnMsg = MyReturnMsg & "<p>OUTLET_4 is ON</p>"
if D5S = 1 then MyReturnMsg = MyReturnMsg & "<p>OUTLET_5 is OFF</p>" else MyReturnMsg = MyReturnMsg & "<p>OUTLET_5 is ON</p>"
if D6S = 1 then MyReturnMsg = MyReturnMsg & "<p>OUTLET_6 is OFF</p>" else MyReturnMsg = MyReturnMsg & "<p>OUTLET_6 is ON</p>"
if D7S = 1 then MyReturnMsg = MyReturnMsg & "<p>OUTLET_7 is OFF</p>" else MyReturnMsg = MyReturnMsg & "<p>OUTLET_7 is ON</p>"
if D8S = 1 then MyReturnMsg = MyReturnMsg & "<p>OUTLET_8 is OFF</p>" else MyReturnMsg = MyReturnMsg & "<p>OUTLET_8 is ON</p>"
   
return
   
User avatar
By forlotto
#35324 yes worked
;)
User avatar
By forlotto
#48191 Is now added as a part of IO function