How to change Xbee address dynamically?

I have two Cerbuino Bee with Xbee Pro 802.15.4, says node1 and node2.
My spider has two buttons and a Xbee Pro.
What I want to do is, when I push button1 the spider will send message to node1, otherwise, if I push button2, the message will send to node2.
I don’t know how to do that if I do not use API mode?

Thanks

I would send an ID as the first bit in the data transfer.
On the Bee if the ID is not it’s ID then ignore the message else process it.

Thanks, the approach you provided is broadcasting the packet to all nodes.
I want to try other approach.
How can i use AT command in NETMF to set the DH and DL address?

I don’t believe there’s any way to do this with the GHI driver. It assumes you’re doing a serial connection between two fixed devices that have been configured in advance with XCTU. I assume you’re using Series 1 modules. You can check out GBee on CodePlex. It has more functionality but as I recall it was only test with Series 2.

It probably wouldn’t be too hard, though, to customize the GHI driver and add a function to allow custom AT commands to be sent. “ATDH” & “ATDL” are the commands you seek.

Thank you ian, all my xbee are S1.
I will check Gbee.
About “customize the GHI driver and add a function to allow custom AT commands”, and example or hint?

Looks like that’s not going to work. I was hoping they were sending AT commands in the driver already but it simply sits on top of the SerialPort object. In case you don’t know, all the GHI driver source is located at:

http://gadgeteer.codeplex.com/

gralin (on this forum) was the main author of the GBee driver. I’m sure he’ll help you out with it if you run into any issues.

The GHI driver is indeed just a wrapper around the serial port object, so if used you would have to construct the AT command strings yourself. This scenario would be for the “transparent” mode of the XBees. The GBee driver has all the commands built in, but only supports API mode. Series 1 XBees come set in transparent mode by default. You can set your XBees to API mode using the X-CTU tool the Digi provides. Not all supported commands are exposed using the AT commands in transparent mode. API mode gives you more functionality, and is quickly where most users end up once they’ve made it past simply sending data between two XBees. The documentation Digi provides for all of this is (IMHO) very good. For the 802.15.4 modules, it can be found here, 802.15.4 RF Modules | Multipoint Wireless Networking | Digi International

Are you coding the receiving devices? If so, just transmit a receiver ID along with your message, then the code the receivers to discard messages with a different receiver ID.

If you have any questions regarding xbee.codeplex.com driver feel free to send am email. I hasn’t been updated in a while but i think i still remember what that project was all about :wink: Also i remember the disappointment that it wasn’t picked up by anyone, especially GHI that requested it :confused: At least we had a good run with @ ransomhall :slight_smile:

If you just want 2 xbees to talk to eachother its easiest to just send the AT commands by hand ( or use xctu and an Xbib or other adapter ) and set the destination addresses manually.
If you are wanting this to work with multiple systems, like an actual product, it’s best to have the application send the at commands on startup.
Usually you check to see if the destination address is set, if it is, you continue, if not, then you set all the parameters you need.

And Yes API mode is best if youre using it for more than a serial port

Keith o