niolabs / python-xbee

Python tools for working with XBee radios
MIT License
101 stars 45 forks source link

ZigBee TX frame composition #13

Closed alexandra111 closed 8 years ago

alexandra111 commented 8 years ago

Hi.

I am trying to develop some code in order to send TX frame. I am new to Python, but I have worked before with XBees in C++ without bigger problems. I am using XBee DigiMesh modules and I declared them as ZigBee objects in the code. Could you please explain me, what am I doing wrong? Unfortunately I get SyntaxError in xbee.send().

from xbee import ZigBee
ser = serial.Serial("7dev7ttyACM0", 9600)
xbee = ZigBee(ser)

 xbee.send('tx',{ 'id'=1, 'frame_id'=1, 'dest_addr_long' = b'\x00\x00\x00\x00\x00\x00\xFF\xFF', 'dest_addr'=b'\xFF\xFE', 'options'=b'\xFF\xFE', 'data'=string })

I am working on Raspberry Pi B

hohenstaufen commented 8 years ago

Works fine with this syntax:

xbee.send('tx', dest_addr_long=b'\x00\x00\x00\x00\x00\x00\xFF\xFF', dest_addr=b'\xFF\xFE', data=b'data')
hansmosh commented 8 years ago

@hohenstaufen's solution looks good to me.