www.rovingnetworks.com
Version 1.0r 9/21/2012
68
RN -W IFLYCR -U M
NOTE:
If the HTML header contains spaces, you must use the $ character to indicate spaces in the string. (A space
is the command delimiter.) When the module’s command parser sees the $, it converts it to a space
character.
Example: Connect to Web Server Every 30 Seconds
Use the following commands to configure the module to connect to a web server every 30 seconds:
set com remote GET$/ob.php?obvar=WEATHER
// Setup the HTML string
set sys auto 30
// Auto-connect every 30 seconds.
set option format 1
// Send header automatically when connection is open
set ip proto 18
// Turn on HTTP mode = 0x10 + TCP mode = 0x2
Connect to a Web Server Automatically when UART Data Is Received
The module supports a mode in which it can connect to the web server when it receives UART data.
NOTE:
If you attempt to send data by typing characters on the keyboard or if your microcontroller is not sending data
fast enough, the module sends out small packets of data (it sends out many packets of small MTU size). To
avoid this issue, set the flush timer to a higher value, e.g.,
set comm time 5000
. By default, it is set to 10 ms.
Example: Connect to Web Server when UART Data Is Received
set ip proto 18
// Turn on HTTP mode = 0x10 and TCP mode = 0x2
set dns name www.webserver.com
// Set the web server name
set ip host 0
// Turn on DNS
set ip remote 80
// Set the web server port, 80 is standard
set com remote GET$/userprog.php?DATA=
// Sample server application
set uart mode 2
// Automatically connect using data trigger mode
When the serial UART data comes in, the module automatically connects to the web server, and sends:
GET /userprog.php?DATA=
<
users serial data
>
\n\n
Post Binary Data
Web servers expect ASCII data. If the user data is binary, the module can convert it to ASCII format before sending it to the
web server.
Example: Convert Data from Binary to ASCII
set ip proto 18
// Turn on HTTP mode = 0x10 and TCP mode = 0x2
set dns name www.webserver.com
// Set the web server name
set ip host 0
// Turn on DNS
set ip remote 80
// Set the web server port, 80 is standard
set com remote GET$/userprog.php?DATA=
// Sample server application
set option format 1
// Convert binary data to ASCII hex format
For example, if the incoming UART data is 6 bytes of binary data with hex values 0x01, 0xAB, 0x03, 0xFF, 0x05, and
0x06, the module sends this string
GET /userprog.php?DATA=01AB03FF0506\n\n
to the web server.