/*****************************************************************************
Here's the code that should make the LEDs on a NeoPixel ring with 60 RGB
LEDs connected to an ATtiny85 chase one by one to and fro with 10
different colors:
This code uses the Adafruit NeoPixel library to control the NeoPixel ring.
It defines an array of 10 different colors to use for the LED chase.
It then loops through each color and chases the LEDs one by one to
the end of the strip, and then back to the beginning of the strip,
using the specified color. The delay between turning on each LED is 50
milliseconds, which gives a nice chasing effect.
AUTHOR ARVIND PATIL 25 MARC23
**********************************************************************************/
#include <Adafruit_NeoPixel.h>
#define PIXEL_PIN 0 // Pin number the NeoPixel is connected to
#define PIXEL_COUNT 96 // Number of pixels in the NeoPixel ring
#define PIXEL_TYPE NEO_GRB + NEO_KHZ800 // Type of NeoPixel (GRB)
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
void setup() {
pixels.begin(); // Initialize the NeoPixel library
}
void loop() {
// Define the 10 different colors to use for the LED chase
uint32_t colors[] = {pixels.Color(255, 0, 0), // Red
pixels.Color(255, 128, 0), // Orange
pixels.Color(255, 255, 0), // Yellow
pixels.Color(0, 255, 0), // Green
pixels.Color(0, 255, 255), // Cyan
pixels.Color(0, 0, 255), // Blue
pixels.Color(128, 0, 255), // Purple
pixels.Color(255, 0, 255), // Magenta
pixels.Color(255, 128, 128), // Light pink
pixels.Color(128, 128, 128)};// Gray
// Loop through the 10 colors
for (int colorIndex = 0; colorIndex < 10; colorIndex++) {
// Chase the LEDs one by one to the end of the strip
for (int i = 0; i < PIXEL_COUNT; i++) {
pixels.setPixelColor(i, colors[colorIndex]);
pixels.show();
delay(50);
}
// Chase the LEDs back to the beginning of the strip
for (int i = PIXEL_COUNT - 1; i >= 0; i--) {
pixels.setPixelColor(i, colors[colorIndex]);
pixels.show();
delay(50);
}
}
}