summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames McKenzie <git@madingley.org>2014-12-08 23:54:08 +0000
committerJames McKenzie <git@madingley.org>2014-12-08 23:54:08 +0000
commita5d8823bf6c362d00a6118c03d16785bebf08f1f (patch)
tree68f0e6351e7617870065404b357c731dadd7dae9
parent1d653f26054c6c866cb9e9f3236ad201d96dc1d5 (diff)
downloadrgb_ring-a5d8823bf6c362d00a6118c03d16785bebf08f1f.tar.gz
rgb_ring-a5d8823bf6c362d00a6118c03d16785bebf08f1f.tar.bz2
rgb_ring-a5d8823bf6c362d00a6118c03d16785bebf08f1f.zip
yellow on green blobby fade
-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.