I would like to handle my xbee with raspberry pi via Python. I install xbee with this command:
pip install xbee
And I try to use this example code:
#! /usr/bin/python
# Import and init an XBee device
from xbee import XBee,ZigBee
import serial
ser = serial.Serial('/dev/ttyUSB0', 9600)
# Use an XBee 802.15.4 device
# To use with an XBee ZigBee device, replace with:
#xbee = ZigBee(ser)
xbee = XBee(ser)
# Set remote DIO pin 2 to low (mode 4)
xbee.remote_at(
dest_addr='\x56\x78',
command='D2',
parameter='\x04')
xbee.remote_at(
dest_addr='\x56\x78',
command='WR')
This code is from this site: Python xbee
When I try to execute this code I got this error:
ImportError: cannot import name Xbee
When I type this command:
pip search xbee
I see the Xbee module:
egenix-mx-base - eGenix mx Base Distribution for Python -
mxDateTime, mxTextTools, mxProxy, mxTools,
mxBeeBase, mxStack, mxQueue, mxURL, mxUID
XBee - Python tools for working with XBee radios
INSTALLED: 2.1.0 (latest)
hachi - XBee API
txXBee - XBee Protocol for Twisted
pyctu - A curses interface to configure xbees
What am I doing wrong? How to import the xbee module to python?