Load the following code onto your GEMMA using the Adafruit Arduino IDE or Codebender:

//Cortana costume animating NeoPixels
//based on the Larson Scanner Shades by Phillip Burgess
//https://learn.adafruit.com/larson-scanner-shades
//modified by Becky Stern for Adafruit
#include <Adafruit_NeoPixel.h>

#define PIN 1

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(21, PIN, NEO_GRB + NEO_KHZ800);

int ringRightSide[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
int ringLeftSide[] = {0, 15, 14, 13, 12, 11, 10, 9, 8};
int singlePixels[] = {16, 17, 18, 19, 20};

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

int pos = 0;
int pos2 = 0;

void loop() {
    // Draw 5 pixels centered on pos.  setPixelColor() will clip any
  // pixels off the ends of the strip, we don't need to watch for that.
  strip.setPixelColor(ringRightSide[abs((pos - 2)%9)], strip.Color(0, 0, 80)); // Dark blue
  strip.setPixelColor(ringRightSide[abs((pos - 1)%9)], strip.Color(0, 0, 150)); // Medium blue
  strip.setPixelColor(ringRightSide[abs((pos    )%9)], strip.Color(15, 15, 200)); // Center pixel is brightest
  strip.setPixelColor(ringRightSide[abs((pos + 1)%9)], strip.Color(0, 0, 150)); // Medium blue
  strip.setPixelColor(ringRightSide[abs((pos + 2)%9)], strip.Color(0, 0, 80)); // Dark blue
  
  strip.setPixelColor(ringLeftSide[abs((pos - 2)%9)], strip.Color(0, 0, 80)); // Dark blue
  strip.setPixelColor(ringLeftSide[abs((pos - 1)%9)], strip.Color(0, 0, 150)); // Medium blue
  strip.setPixelColor(ringLeftSide[abs((pos    )%9)], strip.Color(15, 15, 200)); // Center pixel is brightest
  strip.setPixelColor(ringLeftSide[abs((pos + 1)%9)], strip.Color(0, 0, 150)); // Medium blue
  strip.setPixelColor(ringLeftSide[abs((pos + 2)%9)], strip.Color(0, 0, 80)); // Dark blue
  
  strip.setPixelColor(singlePixels[abs(pos2 - 1)], strip.Color(0, 0, 80)); // Dark blue
  strip.setPixelColor(singlePixels[abs(pos2    )], strip.Color(15, 15, 200)); // Center pixel is brightest
  strip.setPixelColor(singlePixels[abs(pos2 + 1)], strip.Color(0, 0, 80)); // Dark blue
  
    strip.show();
  delay(100);
  
    // Rather than being sneaky and erasing just the tail pixel,
  // it's easier to erase it all and draw a new one next time.
  for(int j=-2; j<= 2; j++) {
    strip.setPixelColor(ringRightSide[(pos+j)%9], 0);
    strip.setPixelColor(ringLeftSide[(pos+j)%9], 0);
    strip.setPixelColor(singlePixels[(pos2+j)%5], 0);
  }
  

  pos += 1;
  if(pos < 0) {
    pos = 1;

  } else if(pos >= 9) {
    pos = 0;

  }

  pos2 += 1;
  if(pos2 < 0) {
    pos2 = 1;
  } else if(pos2 >= 6) {
    pos2 = 0;

  }

}
Last updated on 2015-05-04 at 04.27.44 PM Published on 2014-09-17 at 12.01.07 PM