To configure the XBee radio for direct input, output, or both, you’ll use a set of AT commands that select each pin’s mode and the sample rate for sending the data. There are several steps involved in getting this done, so read carefully through this section at least once before starting to configure your radio.
Here’s the basic I/O command set:
Configures pins 0 through 7 for I/O mode (pins 8 and 9 are not
supported in the current firmware version). The number after the D
indicates which pin you’ll be configuring. The command is followed
by a numeric code that indicates whether the pin is tasked with
digital input, output, analog input (pins 0 to 3 only), some other
function, or nothing at all. For example, to configure I/O pin 2
as a digital input (code 3), the command would be
ATD23. See the I/O settings codes in
Table 4-3 for a
complete list of the codes.
Configures pins 10 11, and 12 for I/O mode (there’s a P3 for
pin 13, but it is not supported in the current firmware). Again,
the number after the P indicates which pin you’ll be configuring,
and is followed by a numeric code to indicate what purpose the pin
will serve—digital in, digital out, or nothing. For example, to
configure I/O pin 11 as a high digital output (code 5) the command
ATP15. Pins 10-12 do
not support any analog functions.
This sets the I/O sample rate—how frequently to report the current pin state and transmit it to the destination address. ...