sparkfun XBee Shield Hook-Up Manual page 12

Hide thumbs Also See for XBee Shield:
Table of Contents

Advertisement

Upload that, then switch over to your XCTU console window. You'll use the
XBee connected to your computer to control and read data from your
Arduino.
All of the XBee magic occurs in serial prints and reads. To send data from
the Arduino XBee,
XBee.print()
strings and other data. To read data from the computer XBee, we can use
, adding
XBee.read()
XBee.available()
in. That's all there is to it!
Check out the comments in the code for a line-by-line dissection.
Remote Controlling/Receiving
When the Arduino sketch first starts up, it will print a helpful usage menu.
After that's printed, follow the directions to send commands to your Arduino.
To control pins 10, 11, 12, and 13, send the hexadecimal equivalent
characters (A, B, C, and D).
– analog write pin
w#nnn
and double-digit values.
◦ Example:
will write pin 6 to 88
w6088
– digital write pin
d#v
#
0, l, or L for LOW.
◦ Example:
will write pin 13 High
ddh
- digital read digital pin
r#
◦ Example:
will digtally read from pin 3.
r3
– analog read analog pin
a#
◦ Example:
will read analog pin 0
a0
In each case, the Arduino will respond with the action it's taken after you've
sent a viable string.
As an initial test, try turning the D13 LED on and off, by sending
.
dd0
Then try setting analog values, or reading from pins. Maybe try making it
more advanced – have a button press trigger an XBee communication. Or
send an alert when an analog input rises past a certain threshold.
This example barely scrapes the surface of what the Arduino-XBee
combination is capable of. XBee's allow you to remotely control your robot
from the comfy confines of your computer. Or you can set up a network of
XBees to monitor carbon-monoxide conditions in every room, while logging
to a single computer.
The power of XBees comes from their simplicity – they make your projects
wireless by simply "serial printing".
Resources & Going Further
That should be enough to get you started. If you're looking for more XBee
and
's are used to write
XBee.println()
tests to check if data has come
to
. Use leading zeros for single-
#
nnn
to
.
can be 1, h, or H for HIGH, and
v
v
#
#
dd1
and
Page 12 of 13

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the XBee Shield and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Wrl-12847

Table of Contents