#include <LiquidCrystal_I2C.h> // Include the LiquidCrystal I2C library
#define LCD_ADDR 0x27 // Define the LCD I2C address
#define LCD_COLUMNS 16 // Define the number of columns in the LCD
#define LCD_ROWS 2 // Define the number of rows in the LCD
// Initialize the LCD object with the specified address, columns, and rows
LiquidCrystal_I2C lcd(LCD_ADDR, LCD_COLUMNS, LCD_ROWS);
int red = 8; // Define pin 8 for the red LED
int yellow = 7; // Define pin 7 for the yellow LED
int cyan = 6; // Define pin 6 for the cyan LED
int purple = 5; // Define pin 5 for the purple LED
int green = 4; // Define pin 4 for the green LED
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud rate
// Set the LED pins as output
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(cyan, OUTPUT);
pinMode(purple, OUTPUT);
pinMode(green, OUTPUT);
// Initialize the LCD
lcd.begin(16,2); // Set up the LCD's number of columns and rows
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the LCD backlight
// Set the cursor to column 5, row 0, and print "HELLO"
lcd.setCursor(5,0);
lcd.print("HELLO");
// Set the cursor to column 1, row 1, and print "SUBS FOR MORE"
lcd.setCursor(1,1);
lcd.print("SUBS FOR MORE");
delay(2000); // Wait for 2 seconds
lcd.clear(); // Clear the LCD screen
}
void loop() {
// Turn all LEDs on
digitalWrite(red, HIGH);
digitalWrite(yellow, HIGH);
digitalWrite(cyan, HIGH);
digitalWrite(purple, HIGH);
digitalWrite(green, HIGH);
delay(100); // Wait for 100 milliseconds
// Turn all LEDs off
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
digitalWrite(cyan, LOW);
digitalWrite(green, LOW);
digitalWrite(purple, LOW);
delay(100); // Wait for 100 milliseconds
// Turn all LEDs on
digitalWrite(red, HIGH);
digitalWrite(yellow, HIGH);
digitalWrite(cyan, HIGH);
digitalWrite(purple, HIGH);
digitalWrite(green, HIGH);
delay(100); // Wait for 100 milliseconds
// Turn all LEDs off
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
digitalWrite(cyan, LOW);
digitalWrite(purple, LOW);
digitalWrite(green, LOW);
delay(100); // Wait for 100 milliseconds
// Turn all LEDs on
digitalWrite(red, HIGH);
digitalWrite(yellow, HIGH);
digitalWrite(cyan, HIGH);
digitalWrite(green, HIGH);
delay(100); // Wait for 100 milliseconds
// Turn all LEDs off
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
digitalWrite(cyan, LOW);
digitalWrite(purple, LOW);
digitalWrite(green, LOW);
delay(100); // Wait for 100 milliseconds
}