Home/Support/Support Forum/Xbee python 802.15.4 with api not responding
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Xbee python 802.15.4 with api not responding

0 votes
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()
asked Oct 11, 2016 in Python by toby New to the Community (3 points)

Please log in or register to answer this question.

1 Answer

0 votes
I don't see anything telling the app to do a serial.read function. I don't even see a serial.write function either. For that matter I don't see you calling the serial port at all.
answered Nov 10, 2016 by mvut Veteran of the Digi Community (14,249 points)
...