#include <FastLED.h>
#define DATA_PIN 4
#define NUM_LEDS 16
#define COLOR_ORDER GRB
#define BRIGHTNESS 255
#define CHIPSET WS2812B
#define VOLTS 5
#define MAX_AMPS 5000
const int buttonPin = 3;
const int ledPin = 13;
int buttonState = 0;
CRGB leds[NUM_LEDS];
void setup()
{
FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS, MAX_AMPS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show();
int color[] = {0xff0000,0x00ff00,0x0000ff,0xffff00};
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop()
{
buttonState = digitalRead(buttonPin);
if(buttonState == LOW)
{
digitalWrite(ledPin,HIGH);
leds[0] = CRGB(255,0,0); //RED
leds[1] = CRGB(0,255,0); //GREEN
//leds[2] = CRGB(0,0,255); //BLUE
leds[2] = CRGB(0x0000ff); //BLUE
leds[3] = CRGB(0xffff00); //YELLOW
FastLED.show();
}
else
{
digitalWrite(ledPin,LOW);
FastLED.clear();
FastLED.show();
}
}