Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <FastLED.h>
  2. #define LED_PIN     7
  3. #define NUM_LEDS    60
  4. #define BRIGHNESS   25
  5.  
  6. CRGB leds[NUM_LEDS];
  7. //--------------------
  8.  
  9.  
  10. void setup() {
  11.   FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
  12.   FastLED.setBrightness(BRIGHNESS);
  13. //--------------------
  14.   pinMode(8, INPUT_PULLUP);
  15.   pinMode(13, OUTPUT);
  16. }
  17. void loop() {
  18.   bool btnState = digitalRead(8);
  19.  
  20.     if (btnState == HIGH){
  21.       digitalWrite(13, HIGH);
  22.      
  23.       for (int i; i < NUM_LEDS; i++){  
  24.           leds[i] = CHSV(0, 255, 255);
  25.       }    
  26.     } else {
  27.       digitalWrite(13, LOW);
  28.      
  29.       for (int i; i < NUM_LEDS; i++){  
  30.         leds[i] = CHSV(160, 255, 255);
  31.       }
  32.     }
  33.    
  34.     FastLED.show();
  35.    
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement