// NeoPixel Ring 2013 Shae Erisson  GPLv3 license to match the rest of the AdaFruit NeoPixel library
// Резисторы не учтены
#include <Adafruit_NeoPixel.h>
#define PIN            10
#define NUMPIXELS      8
// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 100; // delay for half a second
void setup() {   Serial.begin(9600);
  pixels.begin(); // initializes the NeoPixel library.
}
void iterate_pixels(uint32_t c)
{
      for (int i = NUMPIXELS - 1; i >= 0; i--) {
        // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
        pixels.setPixelColor(i, c);
        pixels.show(); // This sends the updated pixel color to the hardware.
        delay(100); // Delay for a period of time (in milliseconds).
        pixels.setPixelColor(i, 0);
        pixels.show();
      }// 1st For
      pixels.clear();
      pixels.show();
}

static uint32_t color_sequence[] = {
  Adafruit_NeoPixel::Color(255, 0, 0),
  Adafruit_NeoPixel::Color(0, 255, 0),
  Adafruit_NeoPixel::Color(0, 0, 255),
  Adafruit_NeoPixel::Color(255, 255, 0),
  Adafruit_NeoPixel::Color(255, 0, 255),
  Adafruit_NeoPixel::Color(0, 255, 255),
};

void loop() {
  for (int i = 0; i < sizeof(color_sequence)/sizeof(color_sequence[0]); ++i) {
    iterate_pixels(color_sequence[i]);
  }
}