Load code to flash memory
Use this command to upload code to the flash compile mode.
Any code uploaded in the flash memory can be set to run automatically when the XBee Cellular Modem boots up. You can also press Ctrl+R to re-run the compiled code at any time.
- Access the MicroPython environment.
- Copy the code you want to paste into the XBee device. For example:
print("Hello world")
- Press Ctrl+F.
MicroPython v1.9.3-999-g00000000 on 2018-01-01; XBee Module with EFX32 Type "help()" for more information. >>> flash compile mode; Ctrl-C to cancel, Ctrl-D to finish 1^^^
- At the MicroPython 1^^^ prompt, right-click and select the Paste option.
MicroPython v1.9.3-999-g00000000 on 2018-01-01; XBee Module with EFX32 Type "help()" for more information. >>> flash compile mode; Ctrl-C to cancel, Ctrl-D to finish 1^^^ print("Hello world")
- Press Ctrl+D to finish. The code is compiled and stored in flash memory.
Compiling 123 bytes of code... Used 0/150 QSTR entries. Compiled 123 bytes of code to 188/7544 bytes of flash. Automatically run this code at startup [Y/n]?
Note The compilation report includes the number of used/available QSTR entries. The QSTR pool is used to store string literals from uploaded code. If a piece of code contains too many string literals, compilation fails and reports a QSTR pool overflow.
- You can choose whether to have the code stored in the flash memory automatically run the next time the XBee device is started. Press Enter to leave the setting unchanged (the default value shown as uppercase).
- Y: Press Y to automatically run the code stored in flash memory upon startup. This sets the PS command to 1. Note that this example only works on startup if you have a terminal open on that serial port and the AP command is set to 4.
- N: Press N to ensure that the code stored in flash memory is not run the next time the XBee device is started. This sets the PS command to 0.