Skip to content

Instantly share code, notes, and snippets.

@mithi
Created July 12, 2015 17:40
Show Gist options
  • Save mithi/85538292e49177c58b06 to your computer and use it in GitHub Desktop.
Save mithi/85538292e49177c58b06 to your computer and use it in GitHub Desktop.
Rainbow Colors with Sparki
#include <Sparki.h>
int i;
int j;
int x;
int y;
int d;
void setup(){
j=0;
x=100;
y=10;
d=200;
}
void loop(){
//red to green 0
//green to red 1
// green to blue 2
// blue to green 3
// blue to red 4
// red to blue 5
for (i = 0; i<= x; i+=5){
switch(j){
case 0: sparki.RGB(x, i, 0); break;
case 1: sparki.RGB(i, x, 0); break;
case 2: sparki.RGB(0, x, i); break;
case 3: sparki.RGB(0, i, x); break;
case 4: sparki.RGB(100, 0, i); break;
case 5: sparki.RGB(i, 0, x); break;
default: j = 0; break;
}
delay(d);
}
sparki.beep();
delay(2000);
sparki.RGB(RGB_OFF);
delay(200);
j++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment