#include <Adafruit_NeoPixel.h>
#define NUMPIXELS 48 // Number of Neopixels
#define PIN 13 // Pin number to which Neopixel data line is connected
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int32_t Wheel(byte WheelPos)
{
return pixels.Color(255 - (WheelPos * 2), 255 - (WheelPos * 2), 0);
}
void theflow(int8_t wait) {
int16_t i, j;
for(j=0; j<=255; j--) {
for(i=NUMPIXELS; i>=0; i--) { //plus plus or minus minus
int32_t whl = Wheel((i+j));
pixels.setPixelColor(i, whl);
}
pixels.show();
delay(wait);
}
}
void setup() {
pixels.begin(); // Initialize Neopixels
}
void loop() {
theflow(10);
// Turn off Neopixels from 101 to 200
// for (int i = 10; i < NUMPIXELS; i++) {
// pixels.setPixelColor(i, pixels.Color(0, 0, 255)); // Set Neopixel color to off (black)
// }
// pixels.show(); // Update Neopixels
// // Trigger Neopixels from 0 to 10
// for (int i = 20; i >= 0; i--) {
// pixels.setPixelColor(i, pixels.Color(255, 0, 0)); // Set Neopixel color to red
// pixels.show(); // Send the updated color information to the Neopixels
// delay(10); // Delay for a short duration to create the sequential effect
// }
// delay(2000); // Wait for 1 second before turning off Neopixels
// // pixels.clear(); // Turn off all Neopixels
// pixels.show(); // Send the updated color information to turn off Neopixels
}