/***********************************************************
pomt on gpt write a code to display poem about ten lines on a lcd2004 i2c connected to arduino uno
by arvind patil 20/08/23
This Arduino sketch uses the "Wire.h" and "LiquidCrystal_I2C.h" libraries to control
an LCD display with I2C communication. It initializes a 20x4 character LCD display and displays
a poem in segments on the LCD, each segment with a delay of 3 seconds. The code demonstrates the
following steps:
The necessary libraries, Wire.h and LiquidCrystal_I2C.h, are included.
An instance of the LiquidCrystal_I2C class, named "lcd," is created with the I2C
address 0x27 and dimensions of 20 columns and 4 rows.
In the "setup()" function:
The LCD is initialized using the "init()" method.
The backlight of the LCD is turned on using "backlight()".
The display is cleared.
The poem is displayed on the LCD in segments with delays:
Each segment consists of a few lines of text printed using "lcd.print()"
and positioned with "lcd.setCursor()".
After displaying each segment, there is a delay of 3 seconds using "delay(3000)".
The "loop()" function is empty for this example.
The code demonstrates how to display different lines of text on the LCD and
control the display timing using delays.
It uses the LiquidCrystal_I2C library to facilitate communication with the LCD2004 display.
**********************************************************/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
lcd.init();
lcd.backlight();
lcd.clear();
// Display the poem on the LCD
lcd.setCursor(0, 0);
lcd.print("In lines of code, a");
lcd.setCursor(0, 1);
lcd.print("world unfolds,");
lcd.setCursor(0, 2);
lcd.print("On LCD2004,");
lcd.setCursor(0, 3);
lcd.print("stories are told.");
delay(3000); // Display each stanza for 3 seconds
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("I2C wires weave");
lcd.setCursor(0, 1);
lcd.print("a digital dance,");
lcd.setCursor(0, 2);
lcd.print("Arduino's heart,");
lcd.setCursor(0, 3);
lcd.print("a canvas to enhance.");
delay(3000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("With twenty columns,");
lcd.setCursor(0, 1);
lcd.print("four rows in sight,");
lcd.setCursor(0, 2);
lcd.print("Pixels unite to");
lcd.setCursor(0, 3);
lcd.print("bring forth light.");
delay(3000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Text and numbers,");
lcd.setCursor(0, 1);
lcd.print("messages clear,");
lcd.setCursor(0, 2);
lcd.print("LCD2004's magic");
lcd.setCursor(0, 3);
lcd.print("draws us near.");
delay(3000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Robotic whispers,");
lcd.setCursor(0, 1);
lcd.print("data's embrace,");
lcd.setCursor(0, 2);
lcd.print("In the LCD's glow,");
lcd.setCursor(0, 3);
lcd.print("we find our place.");
delay(3000);
}
void loop() {
// This loop will not be executed as the poem is displayed in setup()
}