Get started with MicroPython
Use the MicroPython Terminal in XCTU
Digi XBee® 3 802.15.4 RF Module User Guide
39
Use the MicroPython Terminal in XCTU
You can use the MicroPython Terminal to communicate with the XBee 3 802.15.4 RF Module when it is
in MicroPython mode.
1
This requires XCTU 6.3.10 or higher. To enter MicroPython mode, follow the
steps in
Use XCTU to enter the MicroPython environment
. To use the MicroPython Terminal:
1. Click the
Tools
drop-down menu
and select
MicroPython Terminal
. The terminal window
opens.
2. Click
Open
to open the Serial Port Configuration window.
3. In the
Select the Serial/USB port
area, click the COM port that the device uses.
4. Verify that the baud rate and other settings are correct.
5. Click
OK
. The
Open
icon changes to
Close
, indicating that the device is properly connected.
If the
>>>
prompt appears, you are connected properly. You can now type or paste MicroPython code
in the terminal.
MicroPython examples
This section provides examples of how to use some of the basic functionality of MicroPython with the
XBee 3 802.15.4 RF Module.
Example: hello world
1. At the MicroPython
>>>
prompt, type the Python command:
print("Hello, World!")
2. Press
Enter
to execute the command. The terminal echos back
Hello, World!
Example: enter MicroPython paste mode
In the following examples it is helpful to know that MicroPython supports
, where you can
copy a large block of code from this user guide and paste it instead of typing it character by character.
To use paste mode:
1. Copy the code you want to run. For example, copy the following code that is the code from the
"Hello world" example:
print("Hello World")
Note
You can easily copy and paste code from the
. Use caution with the
PDF version, as it may not maintain essential indentations.
2. In the terminal, at the MicroPython
>>>
prompt type
Ctrl
-+
E
to enter paste mode. The terminal
displays
paste mode; Ctrl-C to cancel, Ctrl-D to finish
.
3. Right-click in the MicroPython terminal window and click
Paste
or press
Ctrl+Shift+V
to paste.
4. The code appears in the terminal occupying one line. Each line starts with its line number and
three "
=
" symbols. For example, line 1 starts with
1===
.
1
See
if you do not use the MicroPython Terminal in XCTU.