   send_single_byte(0x80 | blue);
 }
 
+void send_pixel_32(uint32_t c) {
+  
+  send_single_byte((c >> 16) | 0x80);
+  send_single_byte((c >> 8) | 0x80);
+  send_single_byte((c >> 0) | 0x80);
+    
+}
+
 int j = 0;
 int f = 0;
 int k = 0;
 
-
-uint8_t i = 0;
-void loop()
-{
+void color_loop() {
   float brightness = random(100,100)/100.0;
   
   for (uint8_t i = 0; i < LED_COUNT; i++) {

static int LED_COUNT = 32;

void setup()
{

    uint8_t green = 64*(1+sin(i/1.0 + f/9.0  + 2.1))*brightness;
    uint8_t blue =  64*(1+sin(i/3.0 + k/14.0 + 4.2))*brightness;
    
    uint32_t pix = green;
    pix = (pix << 8) | red;
    pix = (pix << 8) | blue;
    
    led_array[i] = pix;
  }
  
  j = j + random(1,2);
  f = f + random(1,2);
  k = k + random(1,2);
}

void loop()
{
 
  color_loop();
  
  for (int x = 0; x < LED_COUNT; x++) {
    send_pixel_32(led_array[x]); 
  }
  
  send_single_byte(0x00);
 
}
