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 copy source files to the board. The on-device compiler turns them into bytecode in RAM and the VM runs that. You can also compile ahead of time with mpy-cross and copy the resulting .mpy file over. Native and viper emitters exist for hot loops; most programs stay on the bytecode VM.

Feature level is a compile-time choice. py/mpconfig.h defines the levels for MICROPY_CONFIG_ROM_LEVEL: MINIMUM (the bare-arm and minimal ports), CORE, BASIC, EXTRA (what most boards use, including the Pico and the ESP8266, and the standard unix build), FULL (the pyscript WebAssembly build) and EVERYTHING. A port picks its level in mpconfigport.h, and each board may switch individual features on or off 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.