 //***************************************************************
-// Example of using memmove8 to transfer pixel data around.
+// Example of using memmove8 to copy/repeat pixel data down strip.
 //
-// A pattern we want to repeat is assigned to the first four pixels.
-// That color data is then repeated down the rest of the strip by
-// using memmove8 to copy it to the other pixels.
+// Random pattern lengths are picks and then then the first n pixels
+// are filled with color data.  The pattern is then copied/repeated
+// down the length of the strip using memmove8.  If the pattern
+// length doesn't divide into NUM_LEDS as a whole number then the
+// last few pixels are copied separately.
 //
 // The snytax for memmove8 is:
 // memmove8( &destination[start position], &source[start position], size of pixel data )


//---------------------------------------------------------------
void loop() {
    // Set first 4 pixels with the pattern we want to repeat.
    fill_rainbow(leds, 4, millis()/20, 20);

    // Copy the pixel data down the rest of the strip.
    CopyPixels();
    
    FastLED.show();  //display leds


}//end_main_loop


//---------------------------------------------------------------
void CopyPixels() {
  // Copy pixel data from frist 4 pixels to rest of strip.

  for (uint8_t i=0; i < NUM_LEDS/4; i++) {
    memmove8( &leds[i*4], &leds[0], (4)*sizeof(CRGB) );
  }

}//end_CopyPixels


//---------------------------------------------------------------
// Reminder of the memmove8 format:
//   memmove8( &destination[start position], &source[start position], size of pixel data )
//---------------------------------------------------------------


#define NUM_LEDS 32

CRGB leds[NUM_LEDS];
uint8_t patternLength = 4;
uint8_t pRepeat = NUM_LEDS / patternLength;
uint8_t pDiff = NUM_LEDS % patternLength;


//---------------------------------------------------------------
