Skip to content
BENIBIX Learn

MicroPython

Development🔌 Embedded & IoTEmbedded Software

Also known as Micro Python, CircuitPython

A small Python that runs on tiny chips. You type it live on the board.

Think of it like

It is like a small Python. It can live in a tiny chip.

Example

Jack plugs in an ESP32 that runs MicroPython. He types two lines at the prompt, and the LED on pin 2 lights up.

Why it matters

If you know Python, you can code a board. You do not need to learn C first.

Definition

MicroPython is a small version of the Python 3 language made to run on microcontrollers. It fits in as little as 256 kilobytes of code space and 16 kilobytes of memory. You plug in a board and type Python at a prompt on the chip itself. A line like turn this pin on works at once, with no compile step. That makes it a quick way to learn and test hardware.

Example code

python
from machine import Pin
led = Pin(2, Pin.OUT)
led.value(1)
Three lines at the chip's prompt set pin 2 as an output and turn it on.
Boards like the ESP32, in the middle, can run MicroPython.

Common mistake

Expecting full Python. Many big libraries do not fit, and the code runs slower than C on the same chip.

Key takeaways

  1. 1
    Python on a chip. The same language, made small.
  2. 2
    Live prompt. Type a line and see it run.
  3. 3
    Small and slower. Fewer libraries than full Python.