#include <Adafruit_NeoPixel.h>
#include <LiquidCrystal_I2C.h>
#define PIN1 5 // Pin 5 connected to RGB Ring 1
#define PIN2 11 // Pin 11 connected to RGB Ring 2
#define NUM_LEDS 16 // Number of LEDs on each Ring
#define LCD_ADDRESS 0x27 // I2C address of your LCD (adjust as needed)
Adafruit_NeoPixel ring1 = Adafruit_NeoPixel(NUM_LEDS, PIN1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel ring2 = Adafruit_NeoPixel(NUM_LEDS, PIN2, NEO_GRB + NEO_KHZ800);
LiquidCrystal_I2C lcd(LCD_ADDRESS, 20, 4); // Adjust the dimensions based on your LCD
int delayval = 250; // Reduced delay in milliseconds
void setup() {
// Initialize RGB Rings
ring1.begin();
ring2.begin();
// Initialize LCD
lcd.begin(20, 4); // Adjust the dimensions based on your LCD
lcd.backlight();
// Display initialization message on LCD
lcd.setCursor(0, 0);
lcd.print("RGB Rings Control");
lcd.setCursor(0, 3);
lcd.print("by arvind 4/12/23");
delay(2000); // Wait for 2 seconds to display the message
// Clear the LCD for the next phase
lcd.clear();
}
void loop() {
// Rainbow chase on Ring 1 clockwise
lcd.setCursor(0, 0);
lcd.print("Ring 1: Rainbow Chase clock wise");
for (int i = 0; i < NUM_LEDS; i++) {
int hue = map(i, 0, NUM_LEDS, 0, 255);
uint32_t color = ring1.ColorHSV(hue * 256, 255, 255);
ring1.setPixelColor(i, color);
ring1.show();
delay(delayval);
}
// Clear the LCD for the next phase
lcd.clear();
// Random chase on Ring 2 anticlockwise
lcd.setCursor(0, 0);
lcd.print("Ring 2: Random Chase anti clock wise");
for (int i = NUM_LEDS - 1; i >= 0; i--) {
uint32_t color = ring2.Color(random(256), random(256), random(256));
ring2.setPixelColor(i, color);
ring2.show();
delay(delayval);
}
// Clear the LCD for the next phase
lcd.clear();
}