5
MicroPython scripting
The SPWF04Sx supports the MicroPython modes represented in
variable “console_enabled” identifies the use of the console together with MicroPython. In detail:
•
"console_enabled" set to 2: this setting allows using both AT commands over the UART and MicroPython
REPL shell.
•
"console_enabled" set to 3: this setting allows only a MicroPython preloaded script to be executed. No
UART/SPI communication is allowed to/from a host processor.
Consequently, the following Python modes are defined:
•
Python Interactive Console (REPL – Read Evaluation Print Loop)
. Mainly used for debugging purposes,
it is activated by the AT+S.Python (Python command) launched without parameters. The REPL is exited by
using a CTRL-D escape character.
•
Run Time Script execution
. Activated with the Python command, it allows to execute the script specified as
parameter. After script execution, control returns to the AT console.
•
DefaultScript Hard Execution
. By using the GPIO(8) set to high at boot time, or when "console_enabled" is
set to 3, the module automatically enters the execution of the script specified by the variable “python_script”.
This mode allows the use of the module without a connected host. Note that "console_enabled" is not
changed by GPIO(8) access: this means that on the subsequent reboot, accessing Python mode again will
require GPIO(8) to be high.
Figure 5.
MicroPython modes
UM2114
MicroPython scripting
UM2114
-
Rev 3
page 10/66