#include <Adafruit_NeoPixel.h>
// Pin to use to send signals to WS2812B
#define LED_PIN 10
// Number of WS2812B LEDs attached to the Arduino
#define LED_COUNT 16
// Setting up the NeoPixel library
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin(); // Initialize NeoPixel object
strip.setBrightness(150); // Set BRIGHTNESS to about 4% (max = 255)
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
rainbow(10);
}
// Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
void rainbow(int wait) {
// 5 cycles of all colors on wheel
for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) {
strip.rainbow(firstPixelHue);
strip.show(); // Update strip with new contents
delay(wait); // Pause for a moment
}
}