Skip to content
lsongdevPublic

About

Visual MicroPython programming for ESP32, Matrix:bit, micro:bit, and Raspberry Pi Pico. Build with blocks, run on real hardware.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

PyBlocks logo

PyBlocks

Build with blocks. Run real MicroPython.

A browser-based programming workspace for ESP32, Matrix:bit, micro:bit, and Raspberry Pi Pico.

Website · Open the editor → · Beginner’s guide · Examples

GitHub Pages deployment status

PyBlocks showing the Say hello program

Design philosophy

Write programs first and choose hardware later. All supported hardware capabilities remain discoverable in one toolbox, without requiring a board selection before editing. See Product and device design for the design principles and proposed deployment experience.

Features

  • Visual blocks with editable Python, project import/export, and local autosave.
  • GPIO, ADC, PWM, sensors, displays, and board-specific peripherals.
  • Wi-Fi, HTTP, MQTT, NTP, exception handling, explicit Python await, and asynchronous tasks.
  • USB upload, firmware installation, device files, and an interactive serial console.
  • English and Simplified Chinese, with offline support as an installable PWA.

Quick start

  1. Open the editor in desktop Chrome or Edge.
  2. Connect your board over USB. If needed, click Install MicroPython firmware and select your board. Installation replaces existing programs and files; back up first.
  3. Start with the default Say hello blocks or open an example project.
  4. In the Device panel, click Upload and run, select the serial port, and read the console output. The Code panel below can be expanded or collapsed independently.

New to programming? Follow the illustrated Beginner’s Guide to say hello, blink an LED, and ask a question. Use Export to keep a portable backup of your work.

The installer supports classic ESP32 Matrix:bit (8 MB), XiaoMiao (4 MB + PSRAM), micro:bit V1/V2, and the original RP2040 Pico. Pico installation requires BOOTSEL mode and WebUSB. Firmware images are downloaded from upstream and checked against pinned hashes before building, then served with the site to avoid browser CORS restrictions. Binaries are not committed to Git. A local copy can also be imported. Networking blocks target the selected ESP32 firmware; available APIs depend on your board and firmware. Close other applications using the serial port before connecting.

SPIKE Prime blocks target the official SPIKE App 3 Python API. Upload and run identifies the selected USB hub, asks for a program slot on first connection, uploads and starts the program, and streams console output. Subsequent uploads reuse the confirmed connection and slot. Use desktop Chrome or Edge and disconnect the LEGO SPIKE App before choosing the hub. See the SPIKE Prime guide.

M5Stack Core/Basic (4 or 16 MB) and original M5Stick-C (4 MB) use model-specific UIFlow2 firmware. See the M5Stack guide for installation, display, buttons, and Stick-C sensors.

Shared condition events use independent definitions and an explicit check statement; hardware updates and scheduling remain explicit. SPIKE retains its own runloop.

Development

Requires Node.js 24+.

git clone https://github.com/lsongdev/pyblocks.git
cd pyblocks
npm ci
npm run dev

npm test runs the automated checks; npm run build creates the production site in dist/. Firmware preparation runs automatically before development and builds. Pushes to main deploy to GitHub Pages.

The static product homepage is index.html; the editor is editor.html; local project management is projects.html. Open the editor directly to create a named IndexedDB project, or open an existing project from My Projects. Edit its name in the header; Import and Export handle portable files. See the website architecture and documentation index.

Block definitions and Python generators live in src/blocks/, editor UI in src/editor/, device communication in src/device/, and installers in src/firmware/.

License

MIT © Lsong. Third-party dependencies and firmware retain their respective licenses.

API coverage

See API coverage for Python and each supported hardware runtime. Dedicated blocks expose common native capabilities; generic Python calls cover additional APIs. Coverage is distinct from physical-device validation.

About

Visual MicroPython programming for ESP32, Matrix:bit, micro:bit, and Raspberry Pi Pico. Build with blocks, run on real hardware.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages