1#include <DigisparkRGB.h>
2
10byte RED = 0;
11byte BLUE = 2;
12byte GREEN = 1;
13byte COLORS[] = {RED, BLUE, GREEN};
14
15
16void setup() {
17 DigisparkRGBBegin();
18}
19
20
21void loop ()
22{
23
24boolean dir = true;
25int i = 0;
26
27while(1)
28{
29fade(COLORS[i%3], dir);
30i++;
31dir = !dir;
32}
33}
34void fade(byte Led, boolean dir)
35{
36int i;
37
38
39if (dir)
40{
41for (i = 0; i < 256; i++)
42{
43DigisparkRGB(Led, i);
44DigisparkRGBDelay(25);
45}
46}
47else
48{
49for (i = 255; i >= 0; i--)
50{
51DigisparkRGB(Led, i);
52DigisparkRGBDelay(25);
53}
54}
55}
56
57
58