#include <Adafruit_NeoPixel.h>
#define PIN            2          // Arduino PWM pin
#define NUMPIXELS     75          // NeoPixel ring size
#define pixDELAY      100          // Delay for pixel persistence
int i; // counter

Adafruit_NeoPixel pix(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(9600);
  pix.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
  pix.clear(); // Set pixel colors to 'off'
  delay(50);
}

void loop() {
  collide();
}

void collide() {
  // RED pixel follows the counter (at the bottom of this function)
  int RED = i;
  pix.setPixelColor (RED, 255, 000, 000);

  // GREEN pixel starts at 1/4 (.25) position on the ring
  int GRN = int(trunc(NUMPIXELS * .25)) - i;
  if (GRN < 0)
    GRN = NUMPIXELS + GRN;
  pix.setPixelColor (GRN, 000, 255, 000);

  // BLUE pixels starts at 1/2 (.5) position on the ring
  int BLU = int(trunc(NUMPIXELS * .5)) + i;
  if (BLU > NUMPIXELS - 1)
    BLU = BLU - NUMPIXELS;
  pix.setPixelColor (BLU, 000, 000, 255);

  // YELLOW pixel starts at 3/4 (.75) position on the ring
  int YEL = int(trunc(NUMPIXELS * .75)) - i;
  if (YEL < 0)
    YEL = abs(NUMPIXELS + YEL);
  pix.setPixelColor (YEL, 255, 255, 0);

  pix.show();
  delay(pixDELAY);

  // BLACK-out the trailing colored pixel
  pix.setPixelColor (RED, 0, 0, 0);
  pix.setPixelColor (GRN, 0, 0, 0);
  pix.setPixelColor (BLU, 0, 0, 0);
  pix.setPixelColor (YEL, 0, 0, 0);

  pix.show(); // show the black-out

  if (i++ == NUMPIXELS - 1)
    i = 0;

  // comment-out these lines to show/hide the locations sent to pix.setPixelColor()
  char buffer[40];
  sprintf(buffer, "RED %5d | GRN %5d | BLU %5d | YEL %5d", RED, GRN, BLU, YEL);
  Serial.println(buffer);
}