84 lines
2.1 KiB
Markdown
84 lines
2.1 KiB
Markdown
# Wiring LED Strip
|
||
* 240 LEDs
|
||
* start of every LED strip is at the female connector
|
||
* green: data
|
||
* red: 5 VCC
|
||
* white: GND
|
||
|
||
* connect green to DATA_PIN 14, which is A0 on the Arduino
|
||
|
||
## Wiring with External Power Source (highly recommended)
|
||
|
||
5V PSU USB → Arduino
|
||
└── GND pin ─────────────────┐
|
||
└── Data pin (A0) ──────┐ │
|
||
│ │
|
||
5V PSU ──── VCC ──→ LED Strip DAT GND
|
||
└─── GND ──→ LED Strip ───────────────┘
|
||
|
||
|
||
# Wiring Guide: 12 Push Buttons + WS2812B LED Strip on Arduino Uno
|
||
|
||
## Available I/O Pins on Arduino Uno
|
||
|
||
| Pin Group | Total | Usable | Notes |
|
||
|---|---|---|---|
|
||
| Digital D0–D13 | 14 | 12 | Avoid D0/D1 — used for Serial TX/RX |
|
||
| Analog A0–A5 | 6 | 6 | Can be used as digital I/O |
|
||
| **Total usable** | | **18** | |
|
||
|
||
## Pin Requirements
|
||
|
||
- 12 push buttons = 12 pins
|
||
- WS2812B data line = 1 pin
|
||
- **Total: 13 pins** (fits within the Uno's 18 usable pins)
|
||
|
||
## Suggested Pin Assignment
|
||
|
||
| Component | Pin |
|
||
|---|---|
|
||
| Button 1 | D2 |
|
||
| Button 2 | D3 |
|
||
| Button 3 | D4 |
|
||
| Button 4 | D5 |
|
||
| Button 5 | D6 |
|
||
| Button 6 | D7 |
|
||
| Button 7 | D8 |
|
||
| Button 8 | D9 |
|
||
| Button 9 | D10 |
|
||
| Button 10 | D11 |
|
||
| Button 11 | D12 |
|
||
| Button 12 | D13 |
|
||
| WS2812B data | A0 (used as digital out) |
|
||
| A1–A5 | free for future use |
|
||
|
||
## Button Wiring
|
||
|
||
Use `INPUT_PULLUP` — no external resistors needed.
|
||
|
||
- Connect each button between its digital pin and **GND**
|
||
- Button reads **LOW** when pressed, **HIGH** when released
|
||
|
||
```cpp
|
||
pinMode(buttonPin, INPUT_PULLUP);
|
||
```
|
||
|
||
## WS2812B Wiring
|
||
|
||
The strip only requires one data pin.
|
||
|
||
```cpp
|
||
#define LED_PIN A0
|
||
#define NUM_LEDS 30
|
||
CRGB leds[NUM_LEDS];
|
||
|
||
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
|
||
```
|
||
|
||
### Power Warning
|
||
|
||
Each WS2812B LED at full white draws ~60mA. If you have more than ~8–10 LEDs:
|
||
|
||
- Power the strip from an **external 5V supply**, not the Uno's 5V pin
|
||
- Share a **common GND** between the external supply, the LED strip, and the Arduino Uno
|