Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define LED_PIN 7
- #define NUM_LEDS 60
- #define BRIGHTNESS 25
- CRGB leds[NUM_LEDS];
- //--------------------
- void setup() {
- FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
- FastLED.setBrightness(BRIGHTNESS);
- //--------------------
- pinMode(8, INPUT_PULLUP);
- pinMode(13, OUTPUT);
- }
- void loop() {
- bool btnState = digitalRead(8);
- if (btnState == HIGH){
- digitalWrite(13, HIGH);
- for (int i; i < NUM_LEDS; i++){
- leds[i] = CHSV(0, 255, 255);
- }
- } else {
- digitalWrite(13, LOW);
- for (int i; i < NUM_LEDS; i++){
- leds[i] = CHSV(160, 255, 255);
- }
- }
- FastLED.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement