Skip to main content
Version: Matrix OS 4.0 🚧

Python App

The Python app runs Python on Matrix OS. Use it to experiment in a serial REPL, run standalone Python apps from device storage, control LEDs, read input, send MIDI, and use the Matrix OS API from Python.

Emergency Exit

To exit the Python app, hold the Function Key for 3 seconds to return to the application launcher.

Features​

  • Interactive Python REPL over USB serial
  • Standalone Python folder apps
  • Matrix OS APIs for LED, Input, MIDI, HID, USB, NVS, FileSystem, Logging, and UI
  • Example apps for games, lighting, runtime probing, and API introspection
  • Pythonic snake_case API names

Connecting to the REPL​

  1. Open the Python app from the application launcher.
  2. Connect to the device over a serial terminal.
  3. Use 115200 baud.
  4. Type Python commands and press Enter.
  5. Use exit() or hold the Function Key for 3 seconds to leave the app.

On Windows, PuTTY works well. Enable the terminal option that treats line feeds as carriage-return plus line-feed if your input appears misaligned.

On macOS and Linux, use screen, minicom, or another serial terminal.

Quick LED Example​

import MatrixOS

MatrixOS.LED.clear()
MatrixOS.LED.set_xy(3, 3, (255, 0, 0))
MatrixOS.LED.update()

MatrixOS.LED.fill((0, 0, 255))
MatrixOS.LED.update()

Quick Input Example​

import MatrixOS

while True:
event = MatrixOS.Input.get_event(10)
if event:
point = event.get("point")
keypad = event.get("keypad")
if point and keypad and keypad["pressed"]:
print("pressed", point)

Standalone Apps​

Standalone Python apps live in:

/MatrixOS/Applications/<appname>/

Each app folder needs an AppInfo.json file and a main Python file:

{
"name": "Python Dice",
"author": "203 Systems",
"color": [255, 255, 0],
"version": 1,
"osMinimalVer": [4, 0, 0],
"appMainFile": "main.py"
}

Available APIs​

For development details, see Python Application Development and the Python Input API.

Comments