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_caseAPI names
Connecting to the REPLβ
- Open the Python app from the application launcher.
- Connect to the device over a serial terminal.
- Use 115200 baud.
- Type Python commands and press Enter.
- 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