
www.rovingnetworks.com
Version 1.0r 9/21/2012
67
RN -W IFLYCR -U M
To make the connection, use the
open
command or you can use
open www.webserver.com 80
. The user’s
microprocessor writes the following string to the UART:
GET /ob.php?obvar=WEATHER \n\n
Where the
\n
is the linefeed character (decimal 10 or hex 0xa). Two linefeeds are required for the web server to know
the page is complete.
NOTE:
Some web servers require a carriage return and linefeed to indication the page is complete. In this case,
use
\r\n
at the end of the string instead of
\n\n
.
Built-In HTML Client Modes
You can set up the module to post data to and get data from a web server automatically without an external host CPU. You
enable these advanced web features using the
set option format
<
flag
> command, where <
flag
> represents a bit-mapped
register. Refer to the “set opt format <
flag
>” command on page 18 for the bit function descriptions. Table 29 describes the
wake reason values.
Table 29. Wake Reason Values
Value
Wake Reason
0
Undefined.
1
Power on or hardware reset (battery install or power up).
2
Sleep (wake when the sleep timer is expired).
3
Sensor.
4
Undefined.
5
Button (RN-370 serial adapter only).
6
Software reboot.
7
Watchdog.
Example: HTML Client Modes
set option format 1
// Automatically send an HTML data header
set option format 7
// Append sensor data in ASCII hex format
set option format 11
// Append all key value pairs to the sensor data
Connect to a Web Server Automatically
You can configure the module to post data to a webserver automatically using the
set sys auto
<
value
> command, where
<
value
> is a decimal number representing seconds. For example, you can configure the module to connect to the web
server every 10 seconds with the
set sys auto 10
command.
When HTTP mode is set, the module automatically appends two linefeeds (
\n\n
) to the end of the packet.