WiFly GSX
www.rovingnetworks.com
WiFlyGSX-um 9/16/2010
809 University Avenue
•
Los Gatos, CA 95032
•
Tel (408) 395-6539
•
~ 48 ~
13.5.
Auto posting sensor data:
WiFly module can send the value of the GPIO and sensor pins:
The data will come as 18 bytes of ASCII HEX: <2 bytes GPIO><channel 0 thru 7 sensor data>
set ip proto 18
// turn on HTTP mode=0x10 + TCP mode = 0x2
set dns name www.webserver.com
//name of your webserver
set ip address 0
// so WiFly will use DNS
set ip remote 80
// standard webserver port
set com remote GET$/userprog.php?DATA=
// sample server application
set q sensor 0xff
// sets WiFly to sample all 8 sensor channels
set sys auto 30
// automatically make the connection every 30 seconds
set option format 7
// send the header plus the sampled binary data converted to ASCII format
The Resulting string sent to the server will be
GET /userprog.php?DATA=0F3000001111222233334444555566667777\n\n
In the above example, the data format is
2 Bytes
GPIO
Channel
0
Channel
1
Channel
2
Channel
3
Channel
4
Channel
5
Channel
6
Channel
7
0F30
0000
1111
2222
3333
4444
5555
6666
7777
13.6.
Examples using the HTML client
Example#1: Auto posting sensor data:
In this example, we will connect to the web server at www.rovingnetworks.com/mike.php?ID= and send
data “ID=1234” every 60 seconds. We will also append the sensor data to the “ID=1234”.
Set the network connections as described above. The other parameters that we need to set are described
below.
Set dns name www.rovingnetworks.com
//set up the URL of the server
Set ip host 0
//instructs RN-370 to use DNS address of host server
Set ip remote 80
//standard web server port
Set ip proto 18
//enable HTTP and TCP protocols
Set com remote GET$/mike.php?ID=1234 //set up the string
Set sys auto 10
//auto connect every 10 seconds
Set option format 7
//send the header and sampled binary data converted to ASCII