//we wish you a merry christmas xylophone from 1:10-1:43
// use the FastLED library (someone's pre-written code)
#include <FastLED.h>
// set how many LEDs there are and the data pin.
const int NUM_LEDS = 30;
const int DATA_PIN = 6;
// this creates an array to reference our LEDs
CRGB leds[NUM_LEDS];
void setup() {
// tells the FastLED code e.g. what LEDs we are using, the data pin
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
// limit the strip's draw to 400mA at 5v
FastLED.setMaxPowerInVoltsAndMilliamps(5, 400);
// turns the brightness down (so my eyes don't hurt)
FastLED.setBrightness(8);
pinMode(2, INPUT_PULLUP);
}
void loop() {
if (digitalRead(2) == LOW) {
lightShow();
}
}
void lightShow() {
//first round (glissando from left to right)
//we wish
for (int light = 0; light < 15; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 0; light < 15; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//you a merry
for (int light = 0; light < 30; light++) {
leds[light].setRGB(random(255), random(255), random(255));
FastLED.show();
delay(25);
}
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//christmas
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//second round (glissando from right to left)
//we wish
for (int light = 0; light < 15; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 0; light < 15; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//you a merry
for (int light = 29; light > 1; light--) {
leds[light].setRGB(random(255), random(255), random(255));
FastLED.show();
delay(25);
}
for (int light = 29; light < 1; light--) {
leds[light] = CRGB::Black;
}
FastLED.show();
//christmas
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//third round (glissando from start and end)
//we wish
for (int light = 0; light < 15; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 0; light < 15; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//you a merry
for (int light = 0; light < 15; light++) {
leds[light].setRGB(random(255), random(255), random(255));
leds[29 - light].setRGB(random(255), random(255), random(255));
FastLED.show();
delay(50);
}
for (int light = 29; light < 1; light--) {
leds[light] = CRGB::Black;
}
FastLED.show();
//christmas
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//and a
leds[10] = CRGB::Blue;
FastLED.show();
delay(259);
leds[20] = CRGB::Blue;
FastLED.show();
delay(259);
//happy new year
for (int light = 0; light < 10; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 10; light < 20; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 20; light < 30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(518);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//bells begin
for (int light = 0; light < 30; light += 2) {
leds[light] = CRGB::Red;
leds[light + 1] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light + 1] = CRGB::Red;
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light] = CRGB::Red;
leds[light + 1] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light + 1] = CRGB::Red;
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light] = CRGB::Red;
leds[light + 1] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light + 1] = CRGB::Red;
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light] = CRGB::Red;
leds[light + 1] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light + 1] = CRGB::Red;
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light] = CRGB::Red;
leds[light + 1] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light + 1] = CRGB::Red;
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light] = CRGB::Red;
leds[light + 1] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light + 1] = CRGB::Red;
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light] = CRGB::Red;
leds[light + 1] = CRGB::Blue;
}
FastLED.show();
delay(259);
for (int light = 0; light < 30; light += 2) {
leds[light + 1] = CRGB::Red;
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(259);
//bells end
//fourth round
//we wish
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
leds[1] = CRGB::Red;
FastLED.show();
delay(388);
leds[1] = CRGB::Black;
FastLED.show();
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
delay(750);
//you a merry christmas
for (int light = 20; light < 30; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 20; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 20; light < 30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 20; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//fifth round
//we wish
leds[1] = CRGB::Blue;
FastLED.show();
delay(388);
leds[1] = CRGB::Black;
FastLED.show();
FastLED.show();
for (int light = 20; light < 30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 20; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
delay(750);
//you a merry christmas
for (int light = 10; light < 20; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 10; light < 20; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 10; light < 20; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 10; light < 20; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//sixth round
leds[1] = CRGB::Green;
FastLED.show();
delay(388);
leds[1] = CRGB::Black;
FastLED.show();
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
delay(750);
//you a merry christmas
for (int light = 0; light < 10; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 0; light < 10; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 0; light < 10; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 0; light < 10; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//and a
leds[10] = CRGB::Blue;
FastLED.show();
delay(259);
leds[20] = CRGB::Blue;
FastLED.show();
delay(259);
//happy new year
for (int light = 0; light < 10; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 10; light < 20; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 20; light < 30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(2072);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//Part C
leds[1] = CRGB::Red;
FastLED.show();
delay(388);
leds[1] = CRGB::Black;
FastLED.show();
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::White;
FastLED.show();
delay(25);
}
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
leds[29] = CRGB::Red;
FastLED.show();
delay(388);
leds[1] = CRGB::Black;
FastLED.show();
for (int light = 29; light > -1; light--) {
leds[light] = CRGB::White;
FastLED.show();
delay(25);
}
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
leds[1] = CRGB::Red;
FastLED.show();
delay(388);
leds[1] = CRGB::Black;
FastLED.show();
for (int light = 29; light > 20; light--) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 20; light > 10; light--) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 10; light > -1; light--) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Gold;
}
FastLED.show();
delay(750);
//we wish
for (int light = 0; light < 15; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 0; light < 15; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 15; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//you a merry
for (int light = 0; light < 15; light++) {
leds[light].setRGB(random(255), random(255), random(255));
leds[29 - light].setRGB(random(255), random(255), random(255));
FastLED.show();
delay(50);
}
for (int light = 29; light < 1; light--) {
leds[light] = CRGB::Black;
}
FastLED.show();
//christmas
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Black;
}
FastLED.show();
//and a
leds[10] = CRGB::Blue;
FastLED.show();
delay(259);
leds[20] = CRGB::Blue;
FastLED.show();
delay(259);
//happy new year
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Red;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Green;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Blue;
}
FastLED.show();
delay(388);
for (int light = 0; light < 30; light++) {
leds[light] = CRGB::Gold;
}
FastLED.show();
}