Micropython ressources

python zvevqx 2025-11-22

ressource website

https://awesome-micropython.com/

ide

https://thonny.org/

linux install :


Official downloads for Linux

Installer (installs private Python 3.10 on x86_64, uses existing python3 elsewhere)
bash <(wget -O - https://thonny.org/installer-for-linux)

Re-using an existing Python installation (for advanced users)
pip3 install thonny
3rd party distributions (may have older version)

Flatpak
flatpak install org.thonny.Thonny

Snap
sudo snap install thonny

Debian, Raspbian, Ubuntu, Mint and others
sudo apt install thonny

Fedora
sudo dnf install thonny

Introduction to MicroPython with Thonny IDE and ESP32

What is MicroPython?

MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimized to run on microcontrollers and in constrained environments. MicroPython Documentation

What is Thonny IDE?

Thonny is a Python IDE for beginners. It has a simple and clean interface, and it is designed specifically for teaching and learning programming. Thonny IDE

What is ESP32?

ESP32 is a series of low-cost, low-power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. ESP32 Series

Getting Started

  1. Install Thonny IDE: Download and install Thonny IDE from the official website. It's available for Windows, macOS, and Linux. Thonny IDE

  2. Set up ESP32 with MicroPython: You'll need to flash the MicroPython firmware onto your ESP32 board. You can do this using a tool like esptool.py. Once you've flashed the firmware, you can connect to the ESP32 using Thonny. Getting Started with ESP32 and MicroPython

  3. Write Your First Program: In Thonny, you can write Python code in the editor on the left and see the output in the shell on the right. Try writing a simple program like blinking an LED or printing to the serial console.

from machine import Pin, Timer

led = Pin(2, Pin.OUT)  # create output pin on GPIO2
tim = Timer(-1)        # create software timer

def blink(timer):
    led.toggle()        # toggle LED

tim.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)  # blink LED at 2.5Hz

This code will blink an LED connected to GPIO2 of the ESP32 at a frequency of 2.5Hz.

Basic Python Concepts

x = 10  # integer
y = "Hello, World!"  # string
z = [1, 2, 3]  # list
def greet(name):
    print(f"Hello, {name}!")

greet("Alice")  # prints "Hello, Alice!"
for i in range(5):
    print(i)  # prints numbers from 0 to 4

x = 10
if x > 0:
    print("x is positive")  # prints "x is positive"

References