/************************************************
https://chatgpt.com/share/ab1dc79a-2d76-4bd2-b59d-f64f8b2e3ea4
****************/
#include <Adafruit_NeoPixel.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define PIN 2 // The pin connected to the NeoPixel strip
#define NUMPIXELS 3 // The number of LEDs in the strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
LiquidCrystal_I2C lcd(0x27, 20, 4); // Set the LCD I2C address to 0x27 for a 20 chars and 4 line display
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
Serial.begin(9600); // Start serial communication at 9600 baud
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
}
void loop() {
showRed();
delay(8000); // Red for 10 seconds
showYellow();
delay(5000); // Yellow for 5 seconds
showGreen();
delay(10000); // Green for 12 seconds
}
void showRed() {
strip.setPixelColor(0, strip.Color(255, 0, 0)); // Red
strip.setPixelColor(1, strip.Color(255, 0, 0)); // Red
strip.setPixelColor(2, strip.Color(255, 0, 0)); // Red
strip.show();
Serial.println("Stop");
lcd.clear();
lcd.setCursor(8,1); // Set cursor to the first line
lcd.print("Stop");
}
void showYellow() {
strip.setPixelColor(0, strip.Color(255, 255, 0)); // Yellow
strip.setPixelColor(1, strip.Color(255, 255, 0)); // Yellow
strip.setPixelColor(2, strip.Color(255, 255, 0)); // Yellow
strip.show();
Serial.println("Wait");
lcd.clear();
lcd.setCursor(8, 1); // Set cursor to the first line
lcd.print("Wait");
}
void showGreen() {
strip.setPixelColor(0, strip.Color(0, 255, 0)); // Green
strip.setPixelColor(1, strip.Color(0, 255, 0)); // Green
strip.setPixelColor(2, strip.Color(0, 255, 0)); // Green
strip.show();
Serial.println("Go");
lcd.clear();
lcd.setCursor(8, 1); // Set cursor to the first line
lcd.print("Go");
lcd.setCursor(5,2 ); // Set cursor to the first line
lcd.print("by Kai29");
}