"sending" http command with a "simple" button

new BookmarkLockedFalling
flotul
New Member
*

flotul Avatar

Posts: 2Male

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?
Roger
metro
Full Member
***

metro Avatar

Posts: 207

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

Last Edit: Dec 31, 2017 6:30:02 GMT -5 by metro
Intel Core2 QUAD CPU @2.54 x 4 Mint Linux 19.3 Mate
flotul
New Member
*

flotul Avatar

Posts: 2Male

Roger