#include <Adafruit_NeoPixel.h>
// Define the number of pixels and the data pin
#define NUM_PIXELS 320
#define DATA_PIN 2
// Create a NeoPixel strip object
Adafruit_NeoPixel strip(NUM_PIXELS, DATA_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
// Initialize the NeoPixel strip
strip.begin();
strip.show(); // Turn off all pixels
}
void loop() {
// Color transitions inspired by Beacon of Magic
colorWipe(strip.Color(255, 0, 0), 50); // Red
sparkle(255, 255, 255, 100, 50); // White sparkle
colorWipe(strip.Color(0, 255, 0), 50); // Green
sparkle(255, 255, 255, 100, 50); // White sparkle
colorWipe(strip.Color(0, 0, 255), 50); // Blue
sparkle(255, 255, 255, 100, 50); // White sparkle
colorWipe(strip.Color(255, 255, 0), 50); // Yellow
sparkle(255, 255, 255, 100, 50); // White sparkle
colorWipe(strip.Color(0, 255, 255), 50); // Cyan
sparkle(255, 255, 255, 100, 50); // White sparkle
colorWipe(strip.Color(255, 0, 255), 50); // Magenta
sparkle(255, 255, 255, 100, 50); // White sparkle
colorWipe(strip.Color(255, 255, 255), 50); // White
}
// Function to fill the strip with a color, one pixel at a time
void colorWipe(uint32_t color, int wait) {
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, color);
strip.show();
delay(wait);
}
}
// Function to create a sparkling effect
void sparkle(byte red, byte green, byte blue, int numSparks, int wait) {
for (int i = 0; i < numSparks; i++) {
// Randomly select a pixel
int pixel = random(0, strip.numPixels());
// Set the pixel color
strip.setPixelColor(pixel, strip.Color(red, green, blue));
// Show the updated pixel color
strip.show();
// Wait for a short duration
delay(wait);
// Turn off the pixel
strip.setPixelColor(pixel, strip.Color(0, 0, 0));
strip.show();
}
}
FPS: 0
Power: 0.00W
Power: 0.00W