/***********************************************************************************************
the code is writen in such a way that for two cycle ll leds chase clockwiase and anticlockwise
using red clockwise,yellow anticlockwise then green green clockwise,cyan anticlockwise
after that led blinks 16 times each time with different colors
author arvind patil . india nandurbar 22 march2023
Copyright Disclaimer Under Section 107 of the Copyright Act 1976, allowance is made for
"fair use" for purposes such as criticism, comment, news reporting, teaching,
scholarship, and research. Fair use is a use permitted by copyright statute that
might otherwise be infringing. Non-profit, educational or personal use tips the balance
in favor of fair use.
************************************************************************************************/
#include <Adafruit_NeoPixel.h>
#define LED_PIN 5
#define LED_COUNT 16
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
// Red clockwise
for (int i = 0; i < LED_COUNT; i++) {
strip.setPixelColor(i, strip.Color(255, 0, 0));
strip.show();
delay(50);
}
delay(500);
for (int i = 0; i < LED_COUNT; i++) {
strip.setPixelColor(i, 0);
strip.show();
delay(50);
}
// Yellow anticlockwise
for (int i = LED_COUNT - 1; i >= 0; i--) {
strip.setPixelColor(i, strip.Color(255, 255, 0));
strip.show();
delay(50);
}
delay(500);
for (int i = 0; i < LED_COUNT; i++) {
strip.setPixelColor(i, 0);
strip.show();
delay(50);
}
// Green clockwise
for (int i = 0; i < LED_COUNT; i++) {
strip.setPixelColor(i, strip.Color(0, 255, 0));
strip.show();
delay(50);
}
delay(500);
for (int i = 0; i < LED_COUNT; i++) {
strip.setPixelColor(i, 0);
strip.show();
delay(50);
}
// Cyan anticlockwise
for (int i = LED_COUNT - 1; i >= 0; i--) {
strip.setPixelColor(i, strip.Color(0, 255, 255));
strip.show();
delay(50);
}
delay(500);
for (int i = 0; i < LED_COUNT; i++) {
strip.setPixelColor(i, 0);
strip.show();
delay(50);
}
// Blink all LEDs
for (int i = 0; i < 16; i++) {
strip.setPixelColor(0, strip.Color(255, 0, 0)); // Red
strip.setPixelColor(1, strip.Color(0, 255, 0)); // Green
strip.setPixelColor(2, strip.Color(0, 0, 255)); // Blue
strip.setPixelColor(3, strip.Color(255, 0, 255)); // Magenta
strip.setPixelColor(4, strip.Color(255, 165, 0)); // Orange
strip.setPixelColor(5, strip.Color(255, 255, 0)); // Yellow
strip.setPixelColor(6, strip.Color(0,255, 255)); // aqua
strip.setPixelColor(7, strip.Color(95, 158, 160)); //cadeblue
strip.setPixelColor(8, strip.Color(255, 127, 80)); // coral
strip.setPixelColor(9, strip.Color(0, 0, 139)); // darkblue
strip.setPixelColor(10, strip.Color(0, 100, 0)); // darkgreen
strip.setPixelColor(11, strip.Color(153, 50, 204)); //darkorchid
strip.setPixelColor(12, strip.Color(255, 20, 147)); //deeppink
strip.setPixelColor(13, strip.Color(255, 0, 255)); // fuchsia
strip.setPixelColor(14, strip.Color(0, 0, 205)); // medium blueBlue
strip.setPixelColor(15, strip.Color(0, 255, 0)); // lime
strip.setPixelColor(16, strip.Color(147, 112, 219)); //mediumpurple
// strip.setPixelColor(5, strip.Color(0, 0, 128)); // navy
// strip.setPixelColor(5, strip.Color(255, 192, 203)); // pink
strip.show();
delay(100);
strip.clear();
strip.show();
delay(100);
}
}