#include <Adafruit_NeoPixel.h>
#define LED_PIN 8
#define LED_COUNT 1
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
}
void loop() {
for (int i = 0; i < 256; i++) {
for (int j = 0; j < strip.numPixels(); j++) {
strip.setPixelColor(j, Wheel((i + j) & 255));
}
strip.show();
delay(20);
}
}
uint32_t Wheel(byte WheelPos) {
if (WheelPos < 85) {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if (WheelPos < 170) {
WheelPos -= 85;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}