#include <FastLED.h>
const int numLeds = 30;
const int ledStripPin = 6;
CRGB leds[numLeds];
void setup() {
FastLED.addLeds<NEOPIXEL, ledStripPin>(leds, numLeds);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 400);
FastLED.setBrightness(8);
pinMode(2, INPUT_PULLUP);
}
void loop() {
if (digitalRead(2) == LOW) {
cycleColours();
}
}
void cycleColours() {
for (int light=0; light<30; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(1000);
for (int light=0; light<30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(1000);
for (int light=0; light<30; light++) {
leds[light] = CRGB::Yellow;
}
FastLED.show();
delay(1000);
for (int light=0; light<30; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(1000);
for (int light=0; light<30; light++) {
leds[light] = CRGB::Purple;
}
FastLED.show();
delay(1000);
}