EasyManuals Logo

Digi XBee 3 ZigBee User Manual

Digi XBee 3 ZigBee
347 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #29 background imageLoading...
Page #29 background image
Get started with MicroPython MicroPython networking and communication examples
Digi XBe 3 Zigbe RF Module
29
Note The xbee.atcmd() method does not support the following AT commands: IS, AS, ED, ND, or DN.
The following is example code that queries and sets a variety of AT commands using xbee.atcmd():
import xbee
# Set the NI string of the radio
xbee.atcmd("NI", "XBee3 module")
# Configure a destination address using two different data types
xbee.atcmd("DH", 0x0013A200) # Hex
xbee.atcmd("DL", b'\x12\x25\x89\xF5') # Bytes
# Read some AT commands and display the value and data type:
print("\nAT command parameter values:")
commands =["DH", "DL", "NI", "CK"]
for cmd in commands:
val = xbee.atcmd(cmd)
print("{}: {:20} of type {}".format(cmd, repr(val), type(val)))
This example code outputs the following:
AT command parameter values:
DH: b'\x00\x13\xa2\x00' of type <class 'bytes'>
DL: b'\x12%\x89\xf5' of type <class 'bytes'>
NI: 'XBee3 module' of type <class 'str'>
CK: 65535 of type <class 'int'>
Note Parameters that store values larger than 16-bits in length are represented as bytes. Python
attempts to print out ASCII characters whenever possible, which can result in some unexpected
output (such as the "%" in the above output). If you want the output from MicroPython to match
XCTU, you can use the following example to convert bytes to hex:
dl_value = xbee.atcmd("DL")
hex_dl_value = hex(int.from_bytes(dl_value, 'big'))
MicroPython networking and communication examples
This section provides networking and communication examples for using MicroPython with the XBee 3
Zigbee RF Module.
Zigbee networks with MicroPython
For small networks, it is suitable to use MicroPython on every node. However, there are some inherit
limitations that may prevent you from using MicroPython on some heavily trafficked nodes:
n When running MicroPython, any received messages will be stored in a small receive queue. This
queue only has room for 4 packets and must be regularly read to prevent data loss. For
networks that will be generating a lot of traffic, the data aggregator may need to operate in
API mode in order to capture all incoming data.
n MicroPython does not have support for all of the XBee API frame types, particularly for source
routing. If you are planning to operate with a network of more than 40 nodes, Digi highly
recommends that you operate with the aggregator in API mode and implement source routing.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Digi XBee 3 ZigBee and is the answer not in the manual?

Digi XBee 3 ZigBee Specifications

General IconGeneral
BrandDigi
ModelXBee 3 ZigBee
CategoryControl Unit
LanguageEnglish

Related product manuals