public:protocols:python-digi-xbee
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| public:protocols:python-digi-xbee [2020/05/10 15:42] – timdv91 | public:protocols:python-digi-xbee [2023/02/26 04:51] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Usage of digi.xbee library | + | ====== Digi.Xbee library:====== |
| + | Usage of digi.xbee library for wireless data communication: | ||
| Source: [[https:// | Source: [[https:// | ||
| + | <code bash Install > pip3 install digi-xbee </ | ||
| + | <code bash fix install error> pip3 install --upgrade setuptools </ | ||
| - | Typical imports: | + | ===== Typical |
| - | <code python> | + | <code python |
| import time | import time | ||
| import sys | import sys | ||
| Line 12: | Line 15: | ||
| </ | </ | ||
| - | Typical instantiation of local device | + | ===== Typical instantiation of local device: |
| - | <code python> | + | <code python |
| # instantiate XbeeDevice object: | # instantiate XbeeDevice object: | ||
| #device = XBeeDevice("/ | #device = XBeeDevice("/ | ||
| Line 22: | Line 25: | ||
| </ | </ | ||
| - | Typical instantiation of a remote device | + | ===== Typical instantiation of a remote device: |
| - | <code python> | + | <code python |
| # Instantiate a remote XBee device object. | # Instantiate a remote XBee device object. | ||
| remote_device = RemoteXBeeDevice(device, | remote_device = RemoteXBeeDevice(device, | ||
| - | remote_device.set_io_configuration(IOLine.DIO11_PWM1, | ||
| </ | </ | ||
| - | Typical serial data transmission: | + | ===== remote pin control: ===== |
| - | * Send text to remote receiver | + | <code python set IO> |
| - | * | + | remote_device.set_io_configuration(IOLine.DIO11_PWM1, |
| - | <code python> | + | </ |
| + | ===== Typical serial data transmission: | ||
| + | * Send text to remote receiver | ||
| + | * receive text back from remote receiver | ||
| + | <code python | ||
| # Send data using the remote object. | # Send data using the remote object. | ||
| #state = device.send_data(remote_device, | #state = device.send_data(remote_device, | ||
| Line 65: | Line 71: | ||
| print(" | print(" | ||
| + | </ | ||
| + | |||
| + | ===== At end of program: ===== | ||
| + | <code python close port> | ||
| device.close() | device.close() | ||
| </ | </ | ||
public/protocols/python-digi-xbee.1589125363.txt.gz · Last modified: (external edit)
