Add triple-tap lights-off and fix LED pin to D5

- Triple tap turns off LEDs; any subsequent tap or hold resumes the current show
- Change LED_DATA_PIN default from 6 to 5 across config, docs, and wiring diagram
- Fix Makefile upload to pass --input-dir so it uses the pre-built binary

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 13:20:36 +02:00
parent ebf01531c5
commit a96f378c9c
5 changed files with 21 additions and 11 deletions
+5 -4
View File
@@ -43,6 +43,7 @@ Button handling uses the [OneButton](https://github.com/mathertel/OneButton) lib
- **Single tap** → next show
- **Double tap** → previous show
- **Triple tap** → lights off; any subsequent tap or hold resumes the current show
- **Long press** → reset to show 0
The key timing values (configured via `setClickMs` and `setPressMs`):
@@ -104,12 +105,12 @@ Edit `config.h`:
// WS2812B (default)
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define LED_DATA_PIN 6
#define LED_DATA_PIN 5
// APA102 / Dotstar (two-wire)
// #define LED_TYPE APA102
// #define COLOR_ORDER BGR
// #define LED_DATA_PIN 6
// #define LED_DATA_PIN 5
// #define LED_CLOCK_PIN 7
```
@@ -129,8 +130,8 @@ static CRGB leds_a[NUM_LEDS];
static CRGB leds_b[NUM_LEDS];
void leds_begin() {
FastLED.addLeds<LED_TYPE, 6, COLOR_ORDER>(leds_a, NUM_LEDS);
FastLED.addLeds<LED_TYPE, 5, COLOR_ORDER>(leds_b, NUM_LEDS);
FastLED.addLeds<LED_TYPE, 5, COLOR_ORDER>(leds_a, NUM_LEDS);
FastLED.addLeds<LED_TYPE, 6, COLOR_ORDER>(leds_b, NUM_LEDS);
FastLED.setBrightness(MAX_BRIGHTNESS);
FastLED.clear(true);
}
+1 -1
View File
@@ -44,7 +44,7 @@ upload: shows build
echo ""; \
exit 1; \
fi
arduino-cli upload --fqbn $(FQBN) --port $(PORT) $(SKETCH)
arduino-cli upload --fqbn $(FQBN) --port $(PORT) --input-dir $(BUILD_DIR) $(SKETCH)
@echo ""
@echo " Uploaded to $(PORT). The show starts immediately."
+7 -5
View File
@@ -26,10 +26,11 @@ SPDX-License-Identifier: BSD-2-Clause
### LED strip
```
Arduino WS2812B strip
─────── ─────────────
GND ──────────────────── GND
D6 ──── [470Ω] ──────── DIN (data in)
Arduino WS2812B strip wire colors
─────── ──────────────────────────
5V ──────────────────── red (VCC)
GND ──────────────────── white (GND)
D5 ──── [470Ω] ──────── green (DIN — data in)
```
Power the strip separately — see the power warning below.
@@ -51,6 +52,7 @@ Uses the internal pull-up resistor. No external resistor needed. Pin 2 can be ch
|-------|--------|
| 1 tap | Next show |
| 2 taps | Previous show |
| 3 taps | Lights off (any tap or hold resumes) |
| Hold (~0.8s) | Reset to show 0 (blue breath) |
### Power warning — read this
@@ -80,7 +82,7 @@ Arduino IDE: **Sketch → Include Library → Manage Libraries**, then install b
### 2. Configure your hardware
Edit `arduino/cosplay_lights/config.h`:
- `LED_DATA_PIN` — pin connected to the strip's DIN (default: 6)
- `LED_DATA_PIN` — pin connected to the strip's DIN (default: 5)
- `BUTTON_PIN` — pin the button is wired to (default: 2)
- `NUM_LEDS` — total LED count on your strip (default: 60)
- `MAX_BRIGHTNESS` — global brightness cap (default: 150)
+2 -1
View File
@@ -18,7 +18,7 @@
// -- Wiring --------------------------------------------------
// Pin on the Arduino connected to the strip's DIN (data-in).
#define LED_DATA_PIN 6
#define LED_DATA_PIN 5
// Clock pin — only needed for APA102/SK9822 strips.
// #define LED_CLOCK_PIN 7
@@ -37,6 +37,7 @@
// Uses INPUT_PULLUP — no external resistor needed.
// 1 tap → next show
// 2 taps → previous show
// 3 taps → lights off (any tap/hold resumes)
// hold → reset to show 0 (blue breath)
#define BUTTON_PIN 2
@@ -5,6 +5,7 @@
* A single button navigates between shows:
* 1 tap — next show
* 2 taps — previous show
* 3 taps — lights off (any tap or hold resumes)
* hold — reset to show 0 (blue breath)
*
* To add or update shows:
@@ -28,8 +29,10 @@ static ShowDef s_show; // PROGMEM cache for the active sh
static uint16_t s_step_index = 0;
static uint32_t s_step_start = 0;
static CRGB s_from_color = CRGB::Black;
static bool s_lights_off = false;
static void load_show(uint8_t index) {
s_lights_off = false;
s_show_index = index;
s_show = read_show_def(&SHOWS[index]);
s_step_index = 0;
@@ -76,6 +79,7 @@ void setup() {
s_button.setPressMs(800);
s_button.attachClick([]() { load_show((s_show_index + 1) % SHOW_COUNT); });
s_button.attachDoubleClick([]() { load_show((s_show_index + SHOW_COUNT - 1) % SHOW_COUNT); });
s_button.attachMultiClick([]() { if (s_button.getNumberClicks() == 3) { s_lights_off = true; leds_apply_color(CRGB::Black); leds_show(); } });
s_button.attachLongPressStart([]() { load_show(0); });
}
@@ -87,6 +91,8 @@ void loop() {
if (now - s_last_frame < 16) return;
s_last_frame = now;
if (s_lights_off) return;
Step step = read_step(&s_show.steps[s_step_index]);
CRGB to = CRGB(step.r, step.g, step.b);
uint8_t t8 = step_progress(step, now);