mirror of
https://github.com/digistump/DigistumpArduino.git
synced 2025-04-27 15:19:02 -07:00
formatting improvements to RGB example
White space-only changes to fix indentation and general consistency withing example
This commit is contained in:
parent
41c25785db
commit
f402493d27
@ -13,46 +13,40 @@ byte GREEN = 1;
|
||||
byte COLORS[] = {RED, BLUE, GREEN};
|
||||
|
||||
// the setup routine runs once when you press reset:
|
||||
void setup() {
|
||||
void setup() {
|
||||
DigisparkRGBBegin();
|
||||
}
|
||||
|
||||
|
||||
void loop ()
|
||||
{
|
||||
//direction: up = true, down = false
|
||||
boolean dir = true;
|
||||
int i = 0;
|
||||
void loop() {
|
||||
//direction: up = true, down = false
|
||||
boolean dir = true;
|
||||
int i = 0;
|
||||
|
||||
while(1) {
|
||||
fade(COLORS[i%3], dir);
|
||||
i++;
|
||||
dir = !dir;
|
||||
}
|
||||
}
|
||||
|
||||
while(1)
|
||||
{
|
||||
fade(COLORS[i%3], dir);
|
||||
i++;
|
||||
dir = !dir;
|
||||
}
|
||||
}
|
||||
void fade(byte Led, boolean dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
//if fading up
|
||||
if (dir)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
DigisparkRGB(Led, i);
|
||||
DigisparkRGBDelay(25);//1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 255; i >= 0; i--)
|
||||
{
|
||||
DigisparkRGB(Led, i);
|
||||
DigisparkRGBDelay(25);//1);
|
||||
}
|
||||
}
|
||||
void fade(byte Led, boolean dir) {
|
||||
int i;
|
||||
|
||||
//if fading up
|
||||
if (dir) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
DigisparkRGB(Led, i);
|
||||
DigisparkRGBDelay(25);//1);
|
||||
}
|
||||
} else {
|
||||
for (i = 255; i >= 0; i--) {
|
||||
DigisparkRGB(Led, i);
|
||||
DigisparkRGBDelay(25);//1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user