Commits

Trammell Hudson  committed d1effd4

add pulse mode

  • Participants
  • Parent commits 6be869d

Comments (0)

Files changed (1)

 	s->c = colors[random(NUM_COLORS)];
 }
 
+
+static void pulse(void)
+{
+	static int pos;
+
+	for (int i=0; i < NUM_PIXELS ; i++)
+		avg_color(i, 0, 10, 0);
+
+	// occasionally pulse everything red
+	if (random(NUM_PIXELS) == 0)
+		for (int i = 0 ; i < NUM_PIXELS ; i++)
+			avg_color(i, 80, 100, 0);
+	// chase a single pixel around
+	avg_color(pos, 10, 1000, 0);
+	pos++;
+	if (pos >= NUM_PIXELS)
+		pos = 0;
+}
+
+
 void loop() {
-    for (int i=0; i < NUM_PIXELS ; i++)
-	avg_color(i, 0, 0, 0);
+    if (0)
+    {
+	    for (int i=0; i < NUM_PIXELS ; i++)
+		avg_color(i, 0, 0, 0);
 
-    for (int i=0 ; i < sizeof(sprites)/sizeof(*sprites) ; i++)
-      draw_wave(&sprites[i]);
+	    for (int i=0 ; i < sizeof(sprites)/sizeof(*sprites) ; i++)
+	      draw_wave(&sprites[i]);
+    } else {
+	pulse();
+    }
 
     sparkle(NUM_PIXELS/2);