|
Post by flotul on Dec 28, 2017 5:03:18 GMT -5
Hi, I'm new to this forum and also beginning discovering the web's programming world (I'm using a Liberty BASIC for a while). I just bought some Ethernet relay modules from SainSmart like this one. As you probably already know, these modules can be controlled via http commands (btw, is this the correct word, "http command"?). Here's an example: http://192.168.1.4/30000/01 : Output-01 HIGH (relay 01 ON) Now to my question: can I assign a "simple" Run BASIC button this kind of command or is there another way to do this? If "yes", does anyone have a short example of the syntax I will need to use please?
|
|
metro
Full Member
Posts: 180
|
Post by metro on Dec 31, 2017 4:00:38 GMT -5
G'day flotul
I'm still a novice hobby programmer and others here may offer something better or in fact something that works. I can't test this as I do not have the relay, this may give you a start though.
button #one, "TURN ON", [TurnOnClicked] 'add a button which will call a scoped subroutine button #two, "TURN OFF", [TurnOffClicked] print wait
[TurnOnClicked] print "relay one is ON" url$="http://192.168.1.4/30000/01" info$="Output-01 HIGH (relay 01 ON)" HTTPPOST$(url$, info$) wait
[TurnOffClicked] print "relay one is OFF" url$="http://192.168.1.4/30000/01" info$="Output-01 HIGH (relay 01 OFF)" HTTPPOST$(url$, info$) wait
|
|
|
Post by flotul on Jan 4, 2018 4:44:44 GMT -5
Thank you Metro,
I'll give it a try and let you know.
Thanks a lot again especially for your piece of code to get me started ;-)
Have a nice day
|
|