|
| 1 | +XBee |
| 2 | +==== |
| 3 | + |
| 4 | +XBee provides an implementation of the XBee serial communication API. It |
| 5 | +allows one to easily access advanced features of one or more XBee |
| 6 | +devices from an application written in Python. An example use case might |
| 7 | +look like this: |
| 8 | + |
| 9 | +.. code:: python |
| 10 | +
|
| 11 | + #! /usr/bin/python |
| 12 | +
|
| 13 | + # Import and init an XBee device |
| 14 | + from xbee import XBee,ZigBee |
| 15 | + import serial |
| 16 | +
|
| 17 | + ser = serial.Serial('/dev/ttyUSB0', 9600) |
| 18 | +
|
| 19 | + # Use an XBee 802.15.4 device |
| 20 | + # To use with an XBee ZigBee device, replace with: |
| 21 | + #xbee = ZigBee(ser) |
| 22 | + xbee = XBee(ser) |
| 23 | +
|
| 24 | + # Set remote DIO pin 2 to low (mode 4) |
| 25 | + xbee.remote_at( |
| 26 | + dest_addr='\x56\x78', |
| 27 | + command='D2', |
| 28 | + parameter='\x04') |
| 29 | +
|
| 30 | + xbee.remote_at( |
| 31 | + dest_addr='\x56\x78', |
| 32 | + command='WR') |
| 33 | +
|
| 34 | +Installation |
| 35 | +============ |
| 36 | + |
| 37 | +Extract the source code to your computer, then run the following command |
| 38 | +in the root of the source tree: |
| 39 | + |
| 40 | +:: |
| 41 | + |
| 42 | + python setup.py install |
| 43 | + |
| 44 | +This will automatically test and install the package for you. |
| 45 | + |
| 46 | +Additionally, one may run this package’s automated tests at any time by |
| 47 | +executing: |
| 48 | + |
| 49 | +:: |
| 50 | + |
| 51 | + python setup.py test |
| 52 | + |
| 53 | +If a Test Fails |
| 54 | +--------------- |
| 55 | + |
| 56 | +If an automated test fails, the installation will be halted to prevent |
| 57 | +one from using a potentially broken build. |
| 58 | + |
| 59 | +In this event, one may comment out the ‘strict’ flag in setup.cfg in |
| 60 | +order to force the installation to proceed. Do so at your own risk. |
| 61 | + |
| 62 | +Documentation |
| 63 | +============= |
| 64 | + |
| 65 | +See the python-xbee project on Google Code |
| 66 | +(https://code.google.com/p/python-xbee/downloads/list) for the latest |
| 67 | +documentation. |
| 68 | + |
| 69 | +To build the documentation yourself, ensure that Sphynx |
| 70 | +(http://sphinx.pocoo.org/) is installed. Then cd into the docs folder, |
| 71 | +and run ‘make html’. The documentation can then be opened in any modern |
| 72 | +web browser at docs/build/html/index.html. |
| 73 | + |
| 74 | +For more information about building or modifying this project’s |
| 75 | +documentation, see the documentation for the Sphinx project. |
| 76 | + |
| 77 | +Dependencies |
| 78 | +============ |
| 79 | + |
| 80 | +PySerial |
| 81 | + |
| 82 | +Additional Dependencies |
| 83 | +----------------------- |
| 84 | + |
| 85 | +To run automated tests: Nose (https://code.google.com/p/python-nose/) To |
| 86 | +build the documentation: Sphinx (http://sphinx.pocoo.org/) |
| 87 | + |
| 88 | +XBee Firmware |
| 89 | +------------- |
| 90 | + |
| 91 | +Please ensure that your XBee device is programmed with the latest |
| 92 | +firmware provided by Digi. Using an old firmware revision is not |
| 93 | +supported and may result in unspecified behavior. |
| 94 | + |
| 95 | +Contributors |
| 96 | +============ |
| 97 | + |
| 98 | +Paul Malmsten pmalmsten@gmail.com Greg Rapp gdrapp@gmail.com Brian |
| 99 | +blalor@bravo5.org Chris Brackert cbrackert@gmail.com |
| 100 | + |
| 101 | +Special Thanks |
| 102 | +============== |
| 103 | + |
| 104 | +Amit Synderman, Marco Sangalli |
0 commit comments