   // no input or commands, so go ahead and send colors
   // just set the first one.
   // ShiftBrite.
+  if (millis() - last > delayMillis) 
+  {
+    last = millis();
+    if (currentColor != -1) {
+      if (currentColor == lightCount)
+        currentColor = 0;
 
-  if (currentColor != -1) {
-    if (currentColor == lightCount)
-      currentColor = 0;
-//    Serial.print("Updating color "); 
-//    Serial.print(currentColor + 1); 
-//    Serial.println(" ");
-
-    shift.sendColor((unsigned long)colors[currentColor][RED_IDX], (unsigned long)colors[currentColor][GREEN_IDX], (unsigned long)colors[currentColor][BLUE_IDX]);
-    currentColor++;
-    delay(delayMillis);
+     shift.sendColor((unsigned long)colors[currentColor][RED_IDX], (unsigned long)colors[currentColor][GREEN_IDX], (unsigned long)colors[currentColor][BLUE_IDX]);
+     currentColor++;
+    }
   }
 
   // No input data, no commands, process analog data

  }  
}

// not using this but it could be useful so I am keeping for now.
void sendCustomData(uint8_t *buf, uint8_t len)
{
  uint8_t data[20] = "Z";
  memcpy(&data[1], buf, len);
  ble_write_string(data, len+1);
}

void readColors(int start, int readCount) {
  for (byte i = start; i < readCount + start; ++i) {
    colors[i][RED_IDX]   = ble_read();
    colors[i][GREEN_IDX] = ble_read();
    colors[i][BLUE_IDX]  = ble_read();
//    Serial.print("read color "); 
//    Serial.print("#");
//    Serial.print( colors[i][RED_IDX], HEX);
//    Serial.print("#"); 
//    Serial.print(colors[i][GREEN_IDX], HEX); 
//    Serial.print("#"); 
//    Serial.println(colors[i][BLUE_IDX], HEX);
  }
}
void loop()

ShiftBrite shift(DATA_PIN, LATCH_PIN, ENABLE_PIN, CLOCK_PIN);
byte colors[MAX_COLORS][3];  // longest chain
int delayMillis;
int last = 0;
int lightCount;
int currentColor;

