Ryan F
Ryan F

Reputation: 175

Raspberry Pi API Mode Troubles

I am having the hardest time trying to get my XBEE's to work with my Raspberry pi (RP). I have one on a USB breakout board into my computer and the other XBEE connected to a RP. The one on the RP is the API coordinator and the one in the computer is the AT router. When I run this program on the RP (which should change one of the IO pins on the router XBEE)

#!/usr/bin/python
import serial
print("TEST")
ser=serial.Serial('/dev/ttyAMA0', baudrate=9600)
print(ser)
ser.write('\x7E')
ser.write('\x00')
ser.write('\x10')
ser.write('\x17')
ser.write('\x00')
ser.write('\x00')
ser.write('\x00')
ser.write('\x00')
ser.write('\x00')
ser.write('\x00')
ser.write('\xFF')
ser.write('\xFF')
ser.write('\xFF')
ser.write('\xFE')
ser.write('\x02')
ser.write('\x44')
ser.write('\x01')
ser.write('\x05')
sum=(0x17+0xFF+0xFF+0xFF+0xFE+0x02+0x44+0x01+0x05)
check=(0xFF - ( sum & 0xFF ))
ser.write(chr(check))
ser.close()
print("DONE")

Nothing gets done on the router though. I believe the XBEE's are connected because when I plug in the router to the computer, I get a message on the serial port of the RP notifying it that something has joined. I am out of ideas, and I was hoping someone could help me out.

Upvotes: 0

Views: 1726

Answers (2)

tomlogic
tomlogic

Reputation: 11694

For Python, you might want to try python-xbee.

And Digi has released a portable ANSI C library that works on POSIX platforms, which should include the Raspberry Pi's embedded Linux.

Upvotes: 0

Ryan F
Ryan F

Reputation: 175

I cannot seem to make it work with Python; however, this is a really awesome API that I would highly recommend. It does use Java though. https://code.google.com/p/xbee-api/

Upvotes: 0

Related Questions