I guess it doesn't matter that much anyway.
Here's a sketch I wrote that's just a pretty RGB animation.
I use it as a default - when I plug in a board I haven't used in a while and see this animation, I will instantly know the board is ready for use
Enjoy:
Code: Select all
// These photons hurt my eyes! A low brightness is low enough.
#define MAXBRIGHT 24
// Initial delay during setup
#define IDELAY 600
// Delay between transitions
#define DELAY 100
// Extra after each state has completed
#define EXTRA_DELAY 1000
const int ledPin = RGB_BUILTIN;
int red = MAXBRIGHT;
int green = 0;
int blue = 0;
int state = 0; // 0: red to yellow, 1: yellow to green, 2: green to cyan, 3: cyan to blue, 4: blue to magenta, 5: magenta to white, 6: white to red
void setup() {
pinMode(ledPin, OUTPUT);
neopixelWrite(ledPin, 0, 0, 0);
delay(DELAY);
// Let's start by just iterating over each color
neopixelWrite(ledPin, MAXBRIGHT, 0, 0);
delay(IDELAY);
neopixelWrite(ledPin, 0, MAXBRIGHT, 0);
delay(IDELAY);
neopixelWrite(ledPin, 0, 0, MAXBRIGHT);
delay(IDELAY);
neopixelWrite(ledPin, MAXBRIGHT, MAXBRIGHT, 0);
delay(IDELAY);
neopixelWrite(ledPin, 0, MAXBRIGHT, MAXBRIGHT);
delay(IDELAY);
neopixelWrite(ledPin, MAXBRIGHT, 0, MAXBRIGHT);
delay(IDELAY);
neopixelWrite(ledPin, MAXBRIGHT, MAXBRIGHT, MAXBRIGHT);
delay(IDELAY);
// Smoothly fade out
for (int i=MAXBRIGHT; i>=0; i--) {
neopixelWrite(ledPin, i, i, i);
delay(DELAY);
}
delay(EXTRA_DELAY);
// Fade into red
for (int i=0; i<=MAXBRIGHT; i++) {
neopixelWrite(ledPin, i, 0, 0);
delay(DELAY);
}
delay(EXTRA_DELAY);
}
void loop() {
switch(state) {
case 0: // red to yellow
green++;
if (green >= MAXBRIGHT) { delay(EXTRA_DELAY); state = 1; }
break;
case 1: // yellow to green
red--;
if (red <= 0) { delay(EXTRA_DELAY); state = 2; }
break;
case 2: // groen to cyan
blue++;
if (blue >= MAXBRIGHT) { delay(EXTRA_DELAY); state = 3; }
break;
case 3: // cyan to blue
green--;
if (green <= 0) { delay(EXTRA_DELAY); state = 4; }
break;
case 4: // blue to magenta
red++;
if (red >= MAXBRIGHT) { delay(EXTRA_DELAY); state = 5; }
break;
case 5: // magenta to white
green++;
if (green >= MAXBRIGHT) { delay(EXTRA_DELAY); state = 6; }
break;
case 6: // white to red
green--;
blue--;
if (green <= 0 && blue <= 0) { delay(EXTRA_DELAY); state = 0; }
break;
}
neopixelWrite(ledPin, red, green, blue);
delay(DELAY);
}