✅ Skema Sederhana Koneksi:
Neopixel DIN → Pin 6 Arduino
Neopixel VCC → 5V
Neopixel GND → GND
Push Button satu sisi → GND
Push Button sisi lain → Pin 2 Arduino (dengan pull-down resistor 10kΩ ke GND)
🧠 Kode Program Arduino:
#include <Adafruit_NeoPixel.h>
#define BUTTON_PIN 2
#define LED_PIN 6
#define NUM_LEDS 8 // Ubah sesuai jumlah LED Neopixel
Adafruit_NeoPixel strip(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);
int buttonState;
int lastButtonState = LOW;
unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 50;
int mode = 0;
void setup() {
pinMode(BUTTON_PIN, INPUT);
strip.begin();
strip.show(); // Matikan semua LED awalnya
}
void loop() {
Butuh Kode Lengkap? Klik Di Sini
📌 Baca Juga: