   }
 }
 
+uint16_t hue_i = 0;
 void sendColors(){
-  // simple FO low-pass between newleds and leds
-  for(uint8_t i_led=0; i_led!=NUM_LEDS; ++i_led)
+  // interpolate between from_hue and to_hue
+  if(++hue_i == HUE_SLOWDOWN*255){
+    //select a new hue
+    from_hue = to_hue;
+    to_hue = random(0,255);
+  }
+  hue = lerp8by8(from_hue,to_hue,hue_i/HUE_SLOWDOWN);
+  
+  // Update the hue for the ALIVE leds
+  for(uint8_t y=0; y!=ROWS; ++y){
+    for(uint8_t x=0; x!=COLS; ++x){
+      if(alive[y][x]){
+        newleds[xy2i(x,y)].setHSV(hue, 255, 255);
+      } else {
+        newleds[xy2i(x,y)] = CRGB::Black;
+      }
+    }
+  }
+  
+  for(uint8_t i_led=0; i_led!=NUM_LEDS; ++i_led){
     for(uint8_t i=0; i!=3; ++i)
       leds[i_led][i] = (uint8_t) (((uint16_t) leds[i_led][i]*24 + newleds[i_led][i])/25);
+  }
   
   LEDS.show();
 }

#include "FastSPI_LED2.h"


#define LOOP_TIME 20
#define UPDATE_TIME 5000
#define SEED_DELAY 10000

#define ROWS 10
#define COLS 10

  
  
  randomSeed(analogRead(A3));
  // generate initial hues
  from_hue = random(0,255);
  to_hue = random(0,255);
  // seed the first cells
  GoLseed();
}
