Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define NUM_LEDS 60
- #define DATA_PIN 6
- const int buttonPin = 2; // the number of the pushbutton pin
- int buttonState = 0;
- CRGBArray<NUM_LEDS> leds;
- CRGB ledsTemp[NUM_LEDS]; //for holding temporary values
- void setup() {
- delay (3000);
- FastLED.addLeds<NEOPIXEL,DATA_PIN>(leds, NUM_LEDS);
- Serial.begin(57600);
- fill_solid( ledsTemp, 20 , CRGB( 0,100,255) );//set range with solid color starting at 0 for 20 pixels
- fill_solid( ledsTemp+20, 20 , CRGB( 100,255,0) );//set range with solid color starting at 20for20 pixels
- fill_solid( ledsTemp+40, 20 , CRGB( 255,0,100) );//set range with solid color starting at 40for 20 pixels
- //leds[5].setRGB( 200, 68, 90);//set specific pixel 5
- //leds[6].setRGB(120, 99, 150); //set specific pixel 6
- pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input:
- }
- void loop(){
- buttonState = digitalRead(buttonPin); // if it is, the buttonState is HIGH:
- if (buttonState == HIGH) {
- for (int j = 0; j<5; j++){
- for(int i = 0; i < NUM_LEDS-11; i++) {
- leds(i,i+2) = ledsTemp [i] ;
- leds(i+5,i+10) = ledsTemp[i];
- leds(i+12,i+15) = ledsTemp [i] ;
- Serial.println (i);
- FastLED.show();
- FastLED.delay(100);
- //delay(100);
- leds(0,60) = CRGB::Black;
- }
- }
- }
- else {//do nothing
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement