Examples: Transmitting Data - Digi XBee 3 ZigBee User Manual

Rf module
Table of Contents

Advertisement

Get started with MicroPython
for node in nodes:
# Set NO back to the default value
xbee.atcmd("NO", 0)
xbee.atcmd("AC")
This produces the following output from two discovered nodes:
Radio discovered:
rssi
node_id
device_type
parent_nwk
sender_nwk
sender_eui64
node_type
Radio discovered:
rssi
node_id
device_type
parent_nwk
sender_nwk
sender_eui64
node_type

Examples: transmitting data

This section provides examples for transmitting data using MicroPython. These examples assume you
have followed the above examples and the two radios are on the same network.
Example: transmit message
Use the xbee module to transmit a message from the XBee 3 Zigbee device. The transmit() function
call consists of the following parameters:
1. The Destination Address, which can be any of the following:
Integer for 16-bit addressing
n
8-byte bytes object for 64-bit addressing
n
Constant xbee.ADDR_BROADCAST to indicate a broadcast destination
n
Constant xbee.ADDR_COORDINATOR to indicate the coordinator
n
2. The Message as a character string.
If the message is sent successfully, transmit() returns None. If the transmission fails due to an ACK
failure or lack of free buffer space on the receiver, the sent packet will be silently discarded.
Example: transmit a message to the network coordinator
1. From the router, access the MicroPython environment.
2. At the MicroPython >>> prompt, type import xbee and press Enter.
Digi XBee® 3 Zigbee® RF Module
print("\nRadio discovered:")
for key, value in node.items():
print("\t{:<12} : {}".format(key, value))
: -63
: Coordinator
: 1179648
: 65534
: 0
: b'\x00\x13\xa2\xff h\x98T'
: 0
: -75
: Router
: 1179648
: 65534
: 23125
: b'\x00\x13\xa2\xffh\x98c&'
: 1
MicroPython networking and communication examples
32

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Table of Contents