First, I tested the communication of 2 XBee (series 2) in AT mode and all worked correctly.
Then I changed the Coordinator to API mode and ran the below script while the router was in AT mode. I was successful and received the routers message. However, I can't get the router to be in API mode and send messages to the coordinator. I'm not sure if i can just do simple send command or if I need to specify the address or if the fames have to be formatted.
Each xbee is connected to a PC. I'm using python 3.4.
Coordinator in API mode to receive messages:
Continuously read the serial port and process IO data received from a remote XBee.
from xbee import XBee,ZigBee
import serial
ser = serial.Serial('/dev/...', 9600)
xbee = ZigBee(ser)
while True:
try:
response = xbee.wait_read_frame()
print(response)
except KeyboardInterrupt:
break
ser.close()
Has someone else done this or know of a site that could help me explain how the router in API works? All I want to do is to send messages from the router to the coordinator.
To communicate in API mode, you must send frame.
A frame is compose by a header and a footer.
There is some library to help you communicate in API
http://ftp1.digi.com/support/utilities/digi_apiframes2.htm
this web site show you how to communicate in API