Receiving Data From Multiple Xbee Series 2b Endpoints
Solution 1:
I think the I/O samples are responses to a remote ATIO
command, so they'll follow the format of a remote AT response, and include a short and long address.
On the XBee module, the short address is ATMY
, and the long address is a combination of ATSH
and ATSL
. I don't know python-xbee well enough to say where they are stored in the ZigBee
object.
Additional information:
Node discovery is different than sending I/O samples. When the host sends ATND to its local XBee, the XBee module sends a broadcast discovery message and passes the responses back to the host. The host can parse the response for addresses and the "node identifier" (ATNI string) from the remote module.
From this address list, the host could send ATIO
commands to remote nodes and parse the responses.
I'm not familiar with the Python-XBee library, so I don't know how it implements node discovery, management of the node table, and sending "remote AT commands" to discovered nodes.
Solution 2:
The xbee packet is a dict
from xbee import ZigBee
import serial
ser = serial.Serial('/dev/ttyAMA0', 9600)
xbee_conn=ZigBee(ser)
xbee_conn.at(command='ND')
whileTrue:
try:
packet = xbee.wait_read_frame()
print packet
except KeyboardInterrupt:
break
ser.close()
To get to the data access it as a dict:
source_address_long = packet['parameter']['source_addr_long']
Hope this helps.
Post a Comment for "Receiving Data From Multiple Xbee Series 2b Endpoints"