Skip to content

Instantly share code, notes, and snippets.

@marmilicious
Created August 8, 2017 17:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marmilicious/363b4e1eaccaf14fd09a754d76aed0f2 to your computer and use it in GitHub Desktop.
Save marmilicious/363b4e1eaccaf14fd09a754d76aed0f2 to your computer and use it in GitHub Desktop.
const uint8_t ppm = 150; //pixels per matrix
//You can do something like this to simply copy the data to the other matrices as the first matrix is filled in.
for (uint16_t i=0; i<ppm; i++) {
leds[i] = CHSV(random8(),255,255);
// copy to other matrices
leds[i + ppm ] = leds[i]; //2nd
leds[i + ppm*2] = leds[i]; //3rd
leds[i + ppm*3] = leds[i]; //4th
leds[i + ppm*4] = leds[i]; //5th
leds[i + ppm*5] = leds[i]; //6th
}
//Or something like this to reverse (mirror) every other one.
for (uint16_t i=0; i<ppm; i++) {
leds[i] = CHSV(random8(),255,255);
// copy and mirror every other one
leds[ppm*2 -1 -i] = leds[i]; //2nd mirrored
leds[i + ppm*2] = leds[i]; //3rd
leds[ppm*4 -1 -i] = leds[i]; //4th mirrored
leds[i + ppm*4] = leds[i]; //5th
leds[ppm*6 -1 -i] = leds[i]; //6th mirrored
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment