#include <Adafruit_NeoPixel.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define PIN_LED_STRIP 8
#define NUMPIXELS_LED_STRIP 24
#define PIN_RGB_RING 6
#define NUMPIXELS_RGB_RING 16
LiquidCrystal_I2C lcd(0x27, 20, 4); // Adjust the dimensions (20x4) based on your LCD
Adafruit_NeoPixel strip_led_strip = Adafruit_NeoPixel(NUMPIXELS_LED_STRIP, PIN_LED_STRIP, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_rgb_ring = Adafruit_NeoPixel(NUMPIXELS_RGB_RING, PIN_RGB_RING, NEO_GRB + NEO_KHZ800);
int delayval = 100; // delay for half a second
void setup() {
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
lcd.setCursor(0, 0);
lcd.print("biltinrgb & neopixel "); // Display initial message
delay(2000); // Wait for 2 seconds
lcd.clear(); // Clear the screen
lcd.setCursor(0, 2);
lcd.print(" arvind patil india"); // Wait for 2 seconds
delay(2000);
lcd.clear(); // Clear the screen
strip_led_strip.begin();
strip_led_strip.show(); // Initialize all LED strip pixels to 'off'
strip_rgb_ring.begin();
strip_rgb_ring.show(); // Initialize all RGB ring pixels to 'off'
}
void loop() {
// Forward chase on LED strip
for (int i = 0; i < NUMPIXELS_LED_STRIP; i++) {
colorWipe(strip_led_strip.Color(random(256), random(256), random(256)), delayval);
}
// Backward chase on RGB ring
for (int i = NUMPIXELS_RGB_RING - 1; i >= 0; i--) {
colorWipe(strip_rgb_ring.Color(random(256), random(256), random(256)), delayval);
}
}
// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for (uint16_t i = 0; i < strip_led_strip.numPixels(); i++) {
strip_led_strip.setPixelColor(i, c);
strip_led_strip.show();
delay(wait);
}
for (uint16_t i = 0; i < strip_rgb_ring.numPixels(); i++) {
strip_rgb_ring.setPixelColor(i, c);
strip_rgb_ring.show();
delay(wait);
}
}