Download the Arduino sketch for the EEG costume cap here:

To create animating patterns for the cap, the pixels are organized into groups based on where they are on the cap, with a new array for each row, listing the pixels in order from front to back.

int R1[] = {25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35};
int R2[] = {24, 23, 22, 21, 20, 19, 18, 17, 16, 15};
int R3[] = {7, 8, 9, 10, 11, 12, 13};
int R4[] = {6, 5, 4, 3, 2, 1, 0};
int L1[] = {46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36};
int L2[] = {47, 48, 49, 50, 51, 52, 53, 54, 55, 56};
int L3[] = {64, 63, 62, 61, 60, 59, 58, 57};
int L4[] = {65, 66, 67, 68, 69, 70, 71};

With each row in it’s own array, you can code up a for loop that steps through multiple arrays at once to create a racing stripe effect.

void flowingStripes(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<11; i++) {
      pixel.setPixelColor(R1[i], c);
      pixel.setPixelColor(R2[i], c);
      pixel.setPixelColor(R3[i], c);
      pixel.setPixelColor(R4[i], c);
      pixel.setPixelColor(L1[i], c);
      pixel.setPixelColor(L2[i], c);
      pixel.setPixelColor(L3[i], c);
      pixel.setPixelColor(L4[i], c);
      pixel.show();
      delay(30);
  }
}

This guide was first published on Jun 17, 2015. It was last updated on Jun 29, 2015.

This page (Code) was last updated on Jun 29, 2015.

Text editor powered by tinymce.