diff --git a/.github/workflows/compile-sketches.yml b/.github/workflows/compile-sketches.yml index 1df13c5..fbedc31 100644 --- a/.github/workflows/compile-sketches.yml +++ b/.github/workflows/compile-sketches.yml @@ -1,13 +1,18 @@ # Compiles sketches on every push to master and every PR, so a change that breaks # a sketch is caught before it lands. Mirrors the CI in makelab-arduino-lib. # -# START-GREEN POLICY: this gates only on folders verified to compile cleanly (via +# START-GREEN POLICY: this gates only on sketches verified to compile cleanly (via # a full arduino-cli sweep). Coverage grows as issues close: # - ESP32/ is mid core-v3.x migration .......... #12 -# - Sensors/PlayingMusic/AddressableLEDs/Serial have wrong-board sketches that -# need per-sketch sketch.yaml board targeting .. #11 -# - CPX/ (samd), nRF52840/ (nrf52), UnoR4WiFi/ ... add once their heavier cores -# are wired in here. +# - The board-specific sketches in Sensors/AddressableLEDs/Serial are now gated +# on their real boards (SAMD / nRF52 / Leonardo) via the matrix jobs below; the +# per-sketch target lives in each sketch's sketch.yaml ........... #11 +# - The remaining plain-Uno sketches in Sensors/PlayingMusic/AddressableLEDs/ +# Serial all compile green and can be added to the Uno job in a follow-up. +# NOTE: arduino/compile-sketches compiles every sketch in a job with that job's +# single fqbn — it does NOT read sketch.yaml. So a folder path can only be gated +# wholesale when every sketch under it targets the same board; mixed-board folders +# must list individual sketches under the matching board's job. # Legacy sketches (docs/legacy-sketches.md) are never gated; add a skip step here # when a gated folder starts including any. name: Compile Sketches @@ -27,28 +32,57 @@ jobs: matrix: include: - fqbn: arduino:avr:uno - platform: arduino:avr + platforms: | + - name: arduino:avr sketch-paths: | - Basics - OLED - Filters - Servo - fqbn: arduino:avr:leonardo - platform: arduino:avr + platforms: | + - name: arduino:avr sketch-paths: | - HumanInterfaceDevice - GameController + # Serial1 (a second hardware UART) doesn't exist on the Uno; these + # need a Leonardo-class board. See each sketch's sketch.yaml. + - Serial/SimpleSerial1Transmitter + - Serial/SimpleSerial1Receiver + - Serial/SimpleSerial1Bidirectional + # I2S MEMS-mic sketches: hardware I2S peripheral ⇒ SAMD (Feather M0). + # I2S.h ships with the Adafruit SAMD core (no separate library). + - fqbn: adafruit:samd:adafruit_feather_m0_express + platforms: | + - name: adafruit:samd + source-url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json + sketch-paths: | + - Sensors/i2s-Microphone + # Onboard-NeoPixel sketches (PIN_NEOPIXEL) ⇒ nRF52840 Feather. + - fqbn: adafruit:nrf52:feather52840 + platforms: | + - name: adafruit:nrf52 + source-url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json + sketch-paths: | + - AddressableLEDs/NeoPixel/BlinkOnboardNeoPixel + - Sensors/Microphone/SoundLevelOnboardNeopixel steps: - name: Checkout uses: actions/checkout@v4 + # The Adafruit nRF52 core invokes adafruit-nrfutil (a pip tool) from its + # build recipe even for a plain compile, so it must be on PATH. It's + # bundled in a normal IDE install but not on the CI runner. + - name: Install adafruit-nrfutil (nRF52 build recipe needs it) + if: startsWith(matrix.fqbn, 'adafruit:nrf52') + run: pip install adafruit-nrfutil + - name: Compile sketches uses: arduino/compile-sketches@v1 with: fqbn: ${{ matrix.fqbn }} - platforms: | - - name: ${{ matrix.platform }} + platforms: ${{ matrix.platforms }} # Libraries used by the gated folders. The MakeabilityLab library is # installed straight from its repo (not yet in Library Manager). The # rest come from Library Manager; deps are listed explicitly so an @@ -65,6 +99,9 @@ jobs: - name: Servo - name: Mouse - name: Keyboard + - name: Adafruit NeoPixel + - name: Adafruit Zero I2S Library + - name: Adafruit Zero DMA Library sketch-paths: ${{ matrix.sketch-paths }} enable-warnings-report: true verbose: false diff --git a/AddressableLEDs/NeoPixel/BlinkOnboardNeoPixel/sketch.yaml b/AddressableLEDs/NeoPixel/BlinkOnboardNeoPixel/sketch.yaml new file mode 100644 index 0000000..984547b --- /dev/null +++ b/AddressableLEDs/NeoPixel/BlinkOnboardNeoPixel/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather nRF52840 Express). +default_fqbn: adafruit:nrf52:feather52840 diff --git a/CLAUDE.md b/CLAUDE.md index dbcd4d1..52aefa7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -18,7 +18,7 @@ There is **no build system, package manifest, or automated test suite.** Each pr ``` arduino-cli compile --fqbn ``` - Each sketch lives in its own folder whose name matches the `.ino` file (Arduino requirement). There is no committed board config; choose the FQBN per sketch by hardware folder: + Each sketch lives in its own folder whose name matches the `.ino` file (Arduino requirement). Most sketches have no committed board config — choose the FQBN per sketch by hardware folder (table below). The exceptions are board-specific sketches that carry a `sketch.yaml` pinning their exact target (see note after the table): | Folder | Board | FQBN | |---|---|---| | `Basics/`, `OLED/`, `Filters/`, `Sensors/`, `Servo/`, etc. | Arduino Uno (AVR) | `arduino:avr:uno` | @@ -29,6 +29,8 @@ There is **no build system, package manifest, or automated test suite.** Each pr | `nRF52840/` | nRF52840 board (verify exact board) | `adafruit:nrf52:feather52840` | Installed cores: `arduino:avr`, `arduino:renesas_uno`, `esp32:esp32`, `adafruit:samd`, `adafruit:nrf52`. The AVR/HID split is inferred from each sketch's APIs (`Mouse.h`/`Keyboard.h` ⇒ Leonardo-class); the `nRF52840/` board defaults to Feather Express but confirm the exact board from the sketch header. Legacy `RedBearDuo/` and Processing have no installable core — skip compile-checking them. + + **Per-sketch `sketch.yaml` (board pinning):** a handful of sketches whose required board differs from their folder default (e.g. the i2s-mic sketches under `Sensors/` need SAMD, the `Serial1` sketches need a Leonardo) carry a one-key `sketch.yaml` with `default_fqbn:`. `arduino-cli` reads it so a bare `arduino-cli compile ` targets the right board; students using the Arduino IDE still select the board manually via `Tools → Board` (the file just shows as a tab). Each `sketch.yaml` is commented to explain this so it isn't a mystery to readers. Note: `arduino/compile-sketches` (the CI action) does **not** read `sketch.yaml` — it compiles a folder with one FQBN per matrix job — so the CI matrix in `.github/workflows/compile-sketches.yml` must independently list mixed-board sketches under the matching board's job. - **Python helpers** (`Python/`): require Python 3 and `pip install pyserial`. Run directly, e.g. `python Python/SerialReader/serial_reader.py --list`. Note the common pitfall: install `pyserial`, **not** `serial`. - **Processing sketches** (`.pde`, `Processing/`): legacy/historical only — the project has shifted to p5.js. Don't invest in modernizing these unless asked. diff --git a/PlayingMusic/SimpleMp3PlayerWithi2sMic/SimpleMp3PlayerWithi2sMic.ino b/PlayingMusic/SimpleMp3PlayerWithi2sMic/SimpleMp3PlayerWithi2sMic.ino index 8fd5b71..c76a32c 100644 --- a/PlayingMusic/SimpleMp3PlayerWithi2sMic/SimpleMp3PlayerWithi2sMic.ino +++ b/PlayingMusic/SimpleMp3PlayerWithi2sMic/SimpleMp3PlayerWithi2sMic.ino @@ -1,3 +1,10 @@ +// ============================================================================ +// LEGACY EXAMPLE (does not compile). +// An abandoned experiment: it #includes the SAMD-only on an nRF52840 +// Feather, and—per the original note below—the i2s-mic and VS1053 mp3 libraries +// are mutually incompatible, so it never worked. Kept for reference only. +// Excluded from compile CI. See docs/legacy-sketches.md. +// ============================================================================ /** * WARNING: this sketch doesn't work due to incompatibilities between the i2s mic library * and the mp3 player library. diff --git a/Sensors/Microphone/SoundLevelOnboardNeopixel/sketch.yaml b/Sensors/Microphone/SoundLevelOnboardNeopixel/sketch.yaml new file mode 100644 index 0000000..984547b --- /dev/null +++ b/Sensors/Microphone/SoundLevelOnboardNeopixel/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather nRF52840 Express). +default_fqbn: adafruit:nrf52:feather52840 diff --git a/Sensors/i2s-Microphone/MicInputPlotter/sketch.yaml b/Sensors/i2s-Microphone/MicInputPlotter/sketch.yaml new file mode 100644 index 0000000..0fdeb8c --- /dev/null +++ b/Sensors/i2s-Microphone/MicInputPlotter/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather M0 Express). +default_fqbn: adafruit:samd:adafruit_feather_m0_express diff --git a/Sensors/i2s-Microphone/MicInputPlotterInterrupt/sketch.yaml b/Sensors/i2s-Microphone/MicInputPlotterInterrupt/sketch.yaml new file mode 100644 index 0000000..0fdeb8c --- /dev/null +++ b/Sensors/i2s-Microphone/MicInputPlotterInterrupt/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather M0 Express). +default_fqbn: adafruit:samd:adafruit_feather_m0_express diff --git a/Sensors/i2s-Microphone/MicPlotterAdafruitZeroI2s/sketch.yaml b/Sensors/i2s-Microphone/MicPlotterAdafruitZeroI2s/sketch.yaml new file mode 100644 index 0000000..0fdeb8c --- /dev/null +++ b/Sensors/i2s-Microphone/MicPlotterAdafruitZeroI2s/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather M0 Express). +default_fqbn: adafruit:samd:adafruit_feather_m0_express diff --git a/Sensors/i2s-Microphone/VUMeter/sketch.yaml b/Sensors/i2s-Microphone/VUMeter/sketch.yaml new file mode 100644 index 0000000..0fdeb8c --- /dev/null +++ b/Sensors/i2s-Microphone/VUMeter/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather M0 Express). +default_fqbn: adafruit:samd:adafruit_feather_m0_express diff --git a/Sensors/i2s-Microphone/VUMeterInterrupt/sketch.yaml b/Sensors/i2s-Microphone/VUMeterInterrupt/sketch.yaml new file mode 100644 index 0000000..0fdeb8c --- /dev/null +++ b/Sensors/i2s-Microphone/VUMeterInterrupt/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather M0 Express). +default_fqbn: adafruit:samd:adafruit_feather_m0_express diff --git a/Sensors/i2s-Microphone/VUMeterInterruptLED/sketch.yaml b/Sensors/i2s-Microphone/VUMeterInterruptLED/sketch.yaml new file mode 100644 index 0000000..0fdeb8c --- /dev/null +++ b/Sensors/i2s-Microphone/VUMeterInterruptLED/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather M0 Express). +default_fqbn: adafruit:samd:adafruit_feather_m0_express diff --git a/Sensors/i2s-Microphone/VUMeterInterruptLEDWithFade/sketch.yaml b/Sensors/i2s-Microphone/VUMeterInterruptLEDWithFade/sketch.yaml new file mode 100644 index 0000000..0fdeb8c --- /dev/null +++ b/Sensors/i2s-Microphone/VUMeterInterruptLEDWithFade/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather M0 Express). +default_fqbn: adafruit:samd:adafruit_feather_m0_express diff --git a/Sensors/i2s-Microphone/VUMeterInterruptOnboardNeopixel/sketch.yaml b/Sensors/i2s-Microphone/VUMeterInterruptOnboardNeopixel/sketch.yaml new file mode 100644 index 0000000..0fdeb8c --- /dev/null +++ b/Sensors/i2s-Microphone/VUMeterInterruptOnboardNeopixel/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Adafruit Feather M0 Express). +default_fqbn: adafruit:samd:adafruit_feather_m0_express diff --git a/Serial/SimpleSerial1Bidirectional/sketch.yaml b/Serial/SimpleSerial1Bidirectional/sketch.yaml new file mode 100644 index 0000000..948906c --- /dev/null +++ b/Serial/SimpleSerial1Bidirectional/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Arduino Leonardo). +default_fqbn: arduino:avr:leonardo diff --git a/Serial/SimpleSerial1Receiver/sketch.yaml b/Serial/SimpleSerial1Receiver/sketch.yaml new file mode 100644 index 0000000..948906c --- /dev/null +++ b/Serial/SimpleSerial1Receiver/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Arduino Leonardo). +default_fqbn: arduino:avr:leonardo diff --git a/Serial/SimpleSerial1Transmitter/sketch.yaml b/Serial/SimpleSerial1Transmitter/sketch.yaml new file mode 100644 index 0000000..948906c --- /dev/null +++ b/Serial/SimpleSerial1Transmitter/sketch.yaml @@ -0,0 +1,4 @@ +# Records the board this sketch is written for, so the Arduino CLI and our +# compile-check CI build it for the right target. In the IDE you still pick the +# board yourself via Tools -> Board (here: Arduino Leonardo). +default_fqbn: arduino:avr:leonardo diff --git a/docs/legacy-sketches.md b/docs/legacy-sketches.md index 50924b9..7fed424 100644 --- a/docs/legacy-sketches.md +++ b/docs/legacy-sketches.md @@ -27,3 +27,12 @@ ESP32/Tone/AnalogInputToneWithOLED ESP32/Tone/BallBounceTone32WithOLED ESP32/Tone/PlayScale ESP32/Tone/PlayScaleWithOLED + +## PlayingMusic — abandoned i2s-mic + mp3 experiment (never worked) + +`SimpleMp3PlayerWithi2sMic` #includes the SAMD-only `` on an nRF52840 +Feather and combines the i2s-mic and Adafruit VS1053 mp3 libraries, which are +mutually incompatible — the sketch's own header documents that it never worked. +Kept for reference; it compiles on no board. + +PlayingMusic/SimpleMp3PlayerWithi2sMic