The language

MicroPython is Python 3 that fits on a microcontroller. The compiler, bytecode and VM are the same idea as CPython; the library is smaller, and hardware shows up as modules.

Learn

Install firmware, open the REPL, write boot.py and blink an LED.

Syntax

What of Python 3 works, what is trimmed, and the usual surprises.

Libraries

machine, network, bluetooth, asyncio, micropython, and CPython differences.

Internals

Lexer, parser, compiler, bytecode, VM and garbage collector.

Ports

How a chip family becomes a firmware tree, and how to add a board.

Embed

Drop the interpreter into C, JavaScript, and other host languages.

Python 3, compiled on the device

You usually type source on the board. The on-device compiler turns it into .mpy bytecode and the VM runs that. You can also compile ahead of time with mpy-cross and copy the bytecode over. Native and viper emitters exist for hot loops; most programs stay on the bytecode VM.

Feature level is a compile-time choice. MICROPY_CONFIG_ROM_LEVEL in py/mpconfig.h ranges from a bare minimum (tiny ESP8266 builds) to extra features (Pico, desktop, WASM). A port then sets mpconfigport.h and each board may override again in mpconfigboard.h.

Where the language stops and the hardware starts

list, dict, classes and async are the language. machine.Pin is the port. The same Pin program blinks an LED on Pico GPIO 25 and on a different number on ESP32. Examples on this site say which pin they assume; device pages say which firmware build to flash.