Created
December 26, 2012 03:54
-
-
Save jonathanhculver/4377711 to your computer and use it in GitHub Desktop.
Christmas lights flashing to trumpet part of All Of The Lights
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
G35: An Arduino library for GE Color Effects G-35 holiday lights. | |
Copyright © 2011 The G35 Authors. Use, modification, and distribution are | |
subject to the BSD license as described in the accompanying LICENSE file. | |
*/ | |
#include <G35String.h> | |
#define LIGHT_COUNT (25) | |
#define G35_PIN (13) | |
G35String lights(G35_PIN, LIGHT_COUNT); | |
int incoming = 0; | |
boolean started = false; | |
char colorArray[12] = {COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_CYAN, COLOR_MAGENTA, COLOR_YELLOW, COLOR_PURPLE, COLOR_ORANGE, COLOR_PALE_ORANGE, COLOR_WARMWHITE, COLOR_INDIGO, COLOR_VIOLET}; | |
void setup() { | |
// setup serial | |
Serial.begin(9600); | |
lights.fill_color(0, LIGHT_COUNT, 0, COLOR_RED); | |
} | |
void loop() { | |
/* if data */ | |
if(Serial.available() > 0) { | |
incoming = Serial.read(); | |
if(incoming ==1 ) { | |
started = true; | |
Serial.println(incoming, DEC); | |
//wait one measure the first time | |
delay(833); | |
} | |
} | |
if(started) { | |
//light code here | |
trumpets(); | |
} | |
} | |
void trumpets() { | |
//1/8 | |
lights.fill_color(0, LIGHT_COUNT, G35::MAX_INTENSITY, COLOR_RED); | |
delay(317); | |
lights.fill_color(0, LIGHT_COUNT, 0, COLOR_RED); | |
delay(100); | |
//pattern repeats 3 times | |
for(int j=0; j<3; j=j+1) { | |
for(int i=0; i<4; i=i+1) { //4 count | |
//1/16 | |
lights.fill_color(0, LIGHT_COUNT, G35::MAX_INTENSITY, colorArray[i]); | |
delay(108); | |
lights.fill_color(0, LIGHT_COUNT, 0, COLOR_RED); | |
delay(100); | |
} | |
for(int i=0; i<2; i=i+1) { //2 count | |
//1/8 | |
lights.fill_color(0, LIGHT_COUNT, G35::MAX_INTENSITY, colorArray[i]); | |
delay(317); | |
lights.fill_color(0, LIGHT_COUNT, 0, COLOR_RED); | |
delay(100); | |
} | |
} | |
for(int i=0; i<4; i=i+1) { //4 count | |
//1/16 | |
lights.fill_color(0, LIGHT_COUNT, G35::MAX_INTENSITY, colorArray[i]); | |
delay(108); | |
lights.fill_color(0, LIGHT_COUNT, 0, COLOR_RED); | |
delay(100); | |
} | |
//1/8 | |
lights.fill_color(0, LIGHT_COUNT, G35::MAX_INTENSITY, COLOR_GREEN); | |
delay(317); | |
lights.fill_color(0, LIGHT_COUNT, 0, COLOR_RED); | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment