formatting improvements to RGB example

White space-only changes to fix indentation and general consistency withing example
This commit is contained in:
Nathan Friedly 2016-03-29 10:59:10 -04:00
parent 41c25785db
commit f402493d27

View File

@ -13,46 +13,40 @@ byte GREEN = 1;
byte COLORS[] = {RED, BLUE, GREEN}; byte COLORS[] = {RED, BLUE, GREEN};
// the setup routine runs once when you press reset: // the setup routine runs once when you press reset:
void setup() { void setup() {
DigisparkRGBBegin(); DigisparkRGBBegin();
} }
void loop () void loop() {
{ //direction: up = true, down = false
//direction: up = true, down = false boolean dir = true;
boolean dir = true; int i = 0;
int i = 0;
while(1) while(1) {
{ fade(COLORS[i%3], dir);
fade(COLORS[i%3], dir); i++;
i++; dir = !dir;
dir = !dir; }
} }
}
void fade(byte Led, boolean dir)
{
int i;
//if fading up void fade(byte Led, boolean dir) {
if (dir) int i;
{
for (i = 0; i < 256; i++) //if fading up
{ if (dir) {
DigisparkRGB(Led, i); for (i = 0; i < 256; i++) {
DigisparkRGBDelay(25);//1); DigisparkRGB(Led, i);
} DigisparkRGBDelay(25);//1);
} }
else } else {
{ for (i = 255; i >= 0; i--) {
for (i = 255; i >= 0; i--) DigisparkRGB(Led, i);
{ DigisparkRGBDelay(25);//1);
DigisparkRGB(Led, i); }
DigisparkRGBDelay(25);//1); }
}
}
} }