Files
led-driver/README.md
T
jimmyandClaude Haiku 5.5 df43820acd Add basic ESP-IDF app skeleton
Adds a minimal ESP-IDF project for ESP32-S3 at the repo root: top-level
CMakeLists, a main component with a C++ app_main that logs a heartbeat,
sdkconfig.defaults selecting esp32s3, and build notes in the README.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-10 23:23:08 +13:00

63 lines
2.2 KiB
Markdown

# LED Driver — MicroPython
MicroPython LED driver for ESP32: presets, patterns, **Wi-Fi** (TCP + UDP discovery) or **ESP-NOW** transport, optional HTTP polling, and dynamic pattern modules under `src/patterns/`.
## Prerequisites
- MicroPython firmware on the ESP32
- USB cable for programming
- Python 3 with pipenv (on the host, for `dev.py` / tests)
## Setup
1. Install dependencies:
```bash
pipenv install
```
2. Deploy to the device:
```bash
pipenv run dev
```
## Project layout
```
led-driver/
├── src/
│ ├── main.py # Entry: Wi-Fi/TCP or ESP-NOW path, process_data(), manifest OTA
│ ├── presets.py # Preset runtime + Presets class
│ ├── preset.py # Single preset helpers
│ ├── settings.py # settings.json
│ ├── hello.py # UDP discovery (port 8766) / hello payloads
│ ├── http_poll.py # Optional HTTP polling helper
│ ├── utils.py # Colour conversion / ordering
│ ├── presets.json # Default preset file (on device)
│ └── patterns/ # Pattern modules (.py), loaded dynamically
├── tests/ # Host-side helpers (e.g. udp_client.py, test_mdns.py)
├── test/ # On-device style pattern tests (all.py, patterns/)
├── dev.py # Deploy / sync to serial device
├── docs/API.md # Wire format (long keys); Pi app docs short keys
├── msg.json # Sample message
├── Pipfile
└── LICENSE
```
**Transport:** `settings.json` **`transport_type`** is typically **`wifi`** (TCP to the Pi on port **8765**, discovery on **8766**) or **`espnow`**. ESP-NOW code paths are loaded only when needed so a Wi-Fi-only image stays smaller.
## Further reading
- **`docs/API.md`** — JSON message fields as used in examples (`pattern`, `colors`, …). The Pi app may send **short keys** (`p`, `c`, …); behaviour matches once normalised on device.
## C++ app (ESP-IDF)
The `cpp` branch adds a basic ESP-IDF project for ESP32-S3 at the repo root (`CMakeLists.txt`, `main/`).
```bash
. ~/.espressif/v6.1/esp-idf/export.sh # or your ESP-IDF install's export.sh
idf.py set-target esp32s3
idf.py build flash monitor
```