summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--blinky.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/blinky.c b/blinky.c
index 0600150..51f86c1 100644
--- a/blinky.c
+++ b/blinky.c
@@ -10,7 +10,7 @@
#include "project.h"
-#define N_COLORS (288*4)
+#define N_COLORS (288*2)
#define N_LEDS 24
@@ -46,13 +46,16 @@ setup_colors (struct RGB *colors, int n)
{
int i;
- int n3 = n / 3;
+ //int n3 = n / 3;
+ int n3 = n / 2;
for (i = 0; i < n; ++i)
{
colors[i].r = ramp (((i) % n) - n3, n3);
- colors[i].g = ramp (((i + n3) % n) - n3, n3);
- colors[i].b = ramp (((i + n3 + n3) % n) - n3, n3);
+ //colors[i].g = ramp (((i + n3) % n) - n3, n3);
+ //colors[i].b = ramp (((i + n3 + n3) % n) - n3, n3);
+ colors[i].g=(128+colors[i].r)/2;
+
printf ("%3d: %3d %3d %3d\n", i, colors[i].r, colors[i].g, colors[i].b);
@@ -73,7 +76,6 @@ main (void)
setup_colors (color, N_COLORS);
-
i = 0;
while (1)
@@ -83,7 +85,8 @@ main (void)
for (j = 0; j < N_LEDS; ++j)
{
k = (j * (N_COLORS - 1)) / (N_LEDS - 1);
- k += i;
+ //k += N_COLORS - i;
+ k+=i;
while (k >= N_COLORS)
k -= N_COLORS;
@@ -95,6 +98,7 @@ main (void)
led[0].r = 255;
led[3].b = 255;
#endif
+
ws2812_setleds (led, N_LEDS);
_delay_ms (5); // wait for 500ms.