While the collar is pretty durable, use caution in heavy rainstorms or really sweaty dance parties-- remove and power down the collar if the circuit is going to get wet. Store your collar in the round, and don't shove it in your bag or it might get twisted or crushed, which could break the circuit.
#include <Adafruit_NeoPixel.h> #define N_LEDS 5 #define PIN 1 Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_RGB + NEO_KHZ800); void setup() { strip.begin(); } int pos = 0, dir = 1; // Position, direction of "eye" void loop() { int j; // 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(pos - 1, 0x100000); // Dark red strip.setPixelColor(pos , 0xFF3000); // Center pixel is brightest strip.setPixelColor(pos + 1, 0x100000); // Dark red strip.show(); delay(70); // 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(j=-2; j<= 2; j++) strip.setPixelColor(pos+j, 0); // Bounce off ends of strip pos += dir; if(pos < 0) { pos = 1; dir = -dir; } else if(pos >= strip.numPixels()) { pos = strip.numPixels() - 2; dir = -dir; } }