Hi,
This code seems to be working but not receiving back “hello world” ?
I can see the transmit led light-up on the grove development board. I can chat over USB with XCTU on MAC os 10.9.
#! /usr/bin/python
Import and init an XBee device
from xbee import XBee, ZigBee
import serial
ser = serial.Serial(‘/dev/tty.usbserial-AK05CKON’, 9600)
Use an XBee 802.15.4 device
xbee = XBee(ser)
To use with an XBee ZigBee device, replace with:
xbee = ZigBee(ser)
Set remote DIO pin 2 to low (mode 4)
xbee.remote_at(
dest_addr=b’\x56\x78’,
command=‘D2’,
parameter=b’\x04’)
xbee.remote_at(
dest_addr=b’\x56\x78’,
command=‘WR’)
def print_data(data):
“”"
This method is called whenever data is received
from the associated XBee device. Its first and
only argument is the data contained within the
frame.
“”"
print data
xbee = XBee(ser, callback=print_data)
xbee.tx(dest_addr=‘\x00\x01’, data=‘Hello World’)
Wait for and get the response
print(xbee.wait_read_frame())
while True:
try:
print xbee.wait_read_frame()
except KeyboardInterrupt:
break
ser.close()