This is an old revision of the document!
MicroPython implements the Python programming language optimized for microcontrollers and embedded systems that are resource-constrained devices. It is simple and enables rapid prototyping.
Here are some key features and characteristics of MicroPython:
Installation of the Micropython usually involves flashing firmware, specific for a microcontroller, that contains a Python interpreter and becomes de-facto a middleware between hardware and developer that is used with means of scripts. Micropython scripts can be executed inline via terminal (REPL), or a file with a source code (usually named main.py
) can be uploaded to the drive's root folder exposed via USB connection by the MCUs firmware.
A website that is a starting point for Micropython is micropython.org[1].
The installation procedure is specific to the hardware platform and sometimes differs slightly from flashing C++-based solutions or burning an OS, as in the case of the RP2040. The main steps to prepare a working environment are presented below:
Once Micropython is installed in the device, it exposes a terminal (REPL) via serial port, either on the dedicated GPIOs for serial or via serial over USB. Developing directly inline is possible (samples are presented in the following chapters), but is not convenient for complex code. Complex and multi-file solutions can benefit from uploading files (even multiple) to the device. A file named main.py
is automatically executed on device restart.
IDEs use those features to simplify development and enable remote code authoring and execution. [pczekalski]Intro to Micropython, explain the idea, installation concept (e.g. RP2040), compare to regular one (move "note" from hardware section) and present sample coding using terminal (GKTerm).