#include <FastLED.h>
#define LED_PIN 2
#define LED_COUNT 48
CRGB leds[LED_COUNT];
#define BUTTON_1 3
#define BUTTON_2 4
#define BUTTON_3 5
CRGB currentColor = CRGB::Black;
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, LED_COUNT);
pinMode(BUTTON_1, INPUT_PULLUP);
pinMode(BUTTON_2, INPUT_PULLUP);
pinMode(BUTTON_3, INPUT_PULLUP);
}
void loop() {
bool button1 = digitalRead(BUTTON_1) == LOW;
bool button2 = digitalRead(BUTTON_2) == LOW;
bool button3 = digitalRead(BUTTON_3) == LOW;
if (button1 && button2) {
currentColor = CRGB::Red;
} else if (button1 && button3) {
currentColor = CRGB::Yellow;
} else if (button2 && button3) {
currentColor = CRGB::Blue;
} else if (button1) {
currentColor = CRGB::Green;
} else if (button2) {
currentColor = CRGB::Pink;
} else if (button3) {
currentColor = CRGB::White;
} else {
currentColor = CRGB::Black;
}
for (int i = 0; i < LED_COUNT; i++) {
leds[i] = currentColor;
}
FastLED.show();
}