xbee.transmit() examples

xbee.transmit() using constants

In this example, the MicroPython code transmits a broadcast message using the xbee.ADDRESS_BROADCAST constant.

  1. Access the MicroPython environment.
  2. Copy the sample code shown below:
import xbee
test_data = 'Hello World!'
xbee.transmit(xbee.ADDR_BROADCAST,test_data)
  1. At the MicroPython >>> prompt type Ctrl+E to enter paste mode. The terminal displays paste mode; Ctrl-C to cancel, Ctrl-D to finish.
  2. At the MicroPython >>> prompt, right-click and select the Paste option.
  3. Once pasted, the code should execute immediately. If the transmission attempt is successful, the MicroPython prompt is returned or else the appropriate error message is displayed.

xbee.transmit() using byte string

In this example, the MicroPython code transmits a broadcast message using the xbee.ADDRESS_BROADCAST constant.

  1. Access the MicroPython environment.
  2. Copy the sample code shown below:
import xbee
test_data = 'Hello World!'
xbee.transmit(b'\x00\x13\xa2\xff\xad\x95\x5a\xa8', test_data)
  1. At the MicroPython >>> prompt type Ctrl+E to enter paste mode. The terminal displays paste mode; Ctrl-C to cancel, Ctrl-D to finish.
  2. At the MicroPython >>> prompt, right-click and select the Paste option.
  3. Once pasted, the code should execute immediately. If the transmission attempt is successful, the MicroPython prompt is returned or else the appropriate error message is displayed.