#include "Wire.h" #include "BlinkM_funcs.h" // include in same folder as .ino byte i; byte Dir; byte cmd; byte Red; byte Blue; byte Green; byte PixelAddress; long RandNumber; unsigned long Timestamp; unsigned long Time; unsigned long Timeloop; void setup() { randomSeed(analogRead(0)); BlinkM_begin(); // Serial.begin(19200); } void loop() { Timeloop = millis() + 15000; //larson timings BlinkM_setFadeSpeed(1, 2); BlinkM_setFadeSpeed(2, 2); BlinkM_setFadeSpeed(3, 2); while (Timeloop > millis()) { Larson(); } Timeloop = millis() +60000; while (Timeloop > millis()) { MoodLighting(); } Timeloop = millis() +15000; while (Timeloop > millis()) { SeahawkParade(); } BlinkM_setFadeSpeed(1, 1); BlinkM_setFadeSpeed(2, 1); BlinkM_setFadeSpeed(3, 1); Timeloop = millis() +15000; while (Timeloop > millis()) { Flash(); } } void MoodLighting() { int FadeSpeed; while(millis() < Timestamp) { } PixelAddress = random(3) + 1; Red = random(256); Green = random(256); Blue = random(256); FadeSpeed = random(1,3); BlinkM_setFadeSpeed(PixelAddress, FadeSpeed); BlinkM_fadeToRGB(PixelAddress, Red, Green, Blue); Timestamp = random(500,2000) + millis(); } void Larson() { BlinkM_setRGB(1, 255, 0, 0); delay(100); BlinkM_fadeToRGB(2, 0, 0, 0); delay(600); BlinkM_setRGB(2, 255, 0, 0); delay(100); BlinkM_fadeToRGB(1, 0, 0, 0); delay(1100); BlinkM_setRGB(3, 255, 0, 0); delay(100); BlinkM_fadeToRGB(2, 0, 0, 0); delay(1100); BlinkM_setRGB(2, 255, 0, 0); delay(100); BlinkM_fadeToRGB(3, 0, 0, 0); delay(1100); BlinkM_setRGB(1, 255, 0, 0); delay(100); BlinkM_fadeToRGB(2, 0, 0, 0); delay(300); } void SeahawkParade() { for (int i=1; i<4; i++) { switch (i) { case 1: BlinkM_setRGB(i, 0, 0, 255); BlinkM_setRGB(2, 0, 255, 0); BlinkM_setRGB(3, 0, 255, 0); delay(100); break; case 2: BlinkM_setRGB(i, 0, 0, 255); BlinkM_setRGB(1, 0, 255, 0); BlinkM_setRGB(3, 0, 255, 0); delay(100); break; case 3: BlinkM_setRGB(i, 0, 0, 255); BlinkM_setRGB(1, 0, 255, 0); BlinkM_setRGB(2, 0, 255, 0); delay(100); break; } } } void Flash() { BlinkM_setRGB(0, 255, 255, 255); BlinkM_fadeToRGB(0, 0, 0, 0); delay(2500); }