The program checks for a radio and its address. If the
address doesn't match the node's ID, we update the XBee.
In this program, the node ID is a constant. I have a client
project currently in process that uses a DIP switch to set
the node address of the device.

In this demo, the main loop is simply waiting on a
packet. If the packet length is correct, we copy it to a local
buffer. The XBee object allows access to its buffer, but I
find this a little less tedious; an array local to the
application is easier to work with. If the packet is the
correct type ($81), the frame is processed.

Let's have a look at the read_millis() method; it's
simple and is similar to the others:

pub read_millis
BaseCmd := $70
bytemove(@RespData, @millis, 4)

The response will echo the command; this is moved to
Command. The value of the milliseconds timer is in millis,
and this is moved to RespData before we send the
response. What are Command and RespData Have a look:

dat

( www.midnightsyndicate.com). It was used in a short film
that is integrated into their live show. Somewhere along
the line, it was decided they wanted to use the prop in the
live show too. The problem we faced was that the prop
has a potentiometer that controls behavior — this is
normally controlled by an actor handling the prop. Now,
This illustrates why I favor fixed-length messages; this
setup keeps the code really clean. In this case, I do have a
master node, but there's no reason why we couldn't allow
any node to directly address any other node. You need
only move the appropriate address to Destination. Again,
remember that these bytes are stored Big Endian. We
could do a direct copy from the query packet like this:
There is a lot more to explore in the downloads,
including a little master program that polls the test node
and displays values. If you build something like it, be
careful about a read type request from the global address
($FFFF) as the responses from a lot of nodes could cause
an overflow of your serial buffer. That said, you can
prevent a node from responding to the global address. To
do this, look at bit 1 of packet[ 7]; if this bit is set, then the
global address is why we're getting the message.

XBee Goes Hollywood

Before I run out of space, I want to share another real
world project using XBees in an interesting way.

This started with my friend, Matt building a prop for
the talented musicians of Midnight Syndicate