WiSnap User Manual 4.41 05282015-ML
Page 45
NOTE:
If you attempt to send data by physically typing characters on the keyboard or if your microcontroller is not
sending data fast enough, the WiSnap module will send out small packets of data (It will send out many packets of
small MTU size). To avoid this, set the flush timer to a higher value. By default, it is set to 10 milliseconds. You can
extend the flush to a higher value (e.g.
set comm. time 5000
).
13.4 Posting binary data:
Web servers expect ASCII data, so if the User data is binary, WiSnap can convert binary data to ASCII format before sending it
to the web server.
Example:
-
set ip proto 18 -
turn on HTTP mode=0x10 + TCP mode = 0x2
-
set dns name www.webserver.com -
name of your web server
-
set ip address 0 -
so WiSnap will use DNS
-
set ip remote 80 -
standard web server port
-
set com remote GET$/userprog.php?DATA= -
sample server application
-
set option format 1 -
converts user binary data in ASCII hex format
If incoming UART data = 6 bytes of binary data with hex values 0x01 0xAB 0x03 0xFF 0x05 0x06 WiSnap will send this string to
the web server:
GET /userprog.php?DATA=01AB03FF0506 \n\n
13.5 Auto posting sensor data:
WiSnap 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 web server
set ip address 0 -
so WiSnap will use DNS
set ip remote 80 -
standard web server port
set com remote GET$/userprog.php?DATA= -
sample server application
set q sensor 0xff -
sets WiSnap to sample all 8 sensor channels
set sys auto 30 -
auto 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
For the above example, the data format is listed in the table below:
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: