followed by a list of files on your XBee. The XBee file root is always /flash.
Inside it you will find a lib and cert folder. There is also a folder with two dots (..)
instead of a name. Use this to go back up a level in the hierarchy. The lib folder
can hold libraries, also known as modules in MicroPython. The cert folder is for
securely storing cer'ficates. For the moment it's fine to ignore these directories.
To move a file from your computer to the XBee, you can simply drag and drop from the left to
the right window. But first you'll need a file! Let's create a simple MicroPython application that
blinks one of the LEDs on the Development board.
Download File
You can download the main.py file for "Blink LED" from here.
... or Create File
1. Open a text editor such as Notepad on Windows or TextEdit on MacOS.
2. Copy in the following code. Each line ends with a comment that explains what that line
does.
NOTE: if you have a Digi XBIB evaluation board, use D10 instead of D4 as the LED pin.
from
machine
import
time
led
= Pin('D4', Pin.OUT)
while
True:
led.on()
print('LED
time.sleep(1)
led.off()
print('LED
time.sleep(1)
3. Save the file as "main.py" on your local hard drive.
4. Next, in the lef side of the XBee Studio's File System interface, navigate to the
"main.py" file that you created or downloaded. Remember that folders named with two
dots will take you up one level in the hierarchy.
5. Once you've located the main.py file, drag it to the XBee's /flash directory on the lef
side of the File System window, anywhere below the "lib" folder.
GSG v.1.1.2
import
Pin
# loads the GPIO Pin library from the machine module
# loads the time module
# defines "led" as an output on pin D4 (or D10)
# run this section of code forever
# turn on the LED
on')
# show LED state in the terminal
# wait for one second
# turn off the LED
off')
# show LED state in the terminal
# wait for one second
19
Need help?
Do you have a question about the XBee Cellular and is the answer not in the manual?
Questions and answers