#include <Adafruit_NeoPixel.h>

#define PIN 2 // Neopixel pin
#define PIX 5 // Number of Neopixels

Adafruit_NeoPixel pixel = Adafruit_NeoPixel(PIX, PIN, NEO_GRB + NEO_KHZ800);

unsigned long fadeTimer, fadeTimeout = 1000; // microseconds
int minimum = 0, maximum = 255, increase, decrease; // counters
int dir = 1, fade = 1;
byte pixels[PIX];

void setup() {
  Serial.begin(115200);
  pixel.begin(); // initialize a Neopixel object/instance on pin 3
  pixel.clear(); // clear any set pixel in the buffer
  pixel.show(); // display the pixel buffer
}

void loop() {
  for (int i = 0; i < 5; i++) {
    if (micros() - fadeTimer > fadeTimeout) { // if "start" to "now" is greater than "interval"...
      fadeTimer = micros(); // ... start a new "start time" and...
      if (fade < 1 || fade > 191) { //... if fade reached the boundaries...
        dir = -dir; // ... change direction
      }
      fade += dir;
      setFadeColor(fade, 255, 255);
    }
  }
}

void setFadeColor(int red, int grn, int blu) {
  for (int i = 0; i < PIX; i ++) {
    pixel.setPixelColor(i, pixel.Color(red, grn, blu));
    pixel.show();
  }
}