In this post, we are going make a program which will show three names at delay of 10 seconds using Arduino microcontroller and Liquid Crystal Display. Moreover, you will require two libraries Wire and LiquidCrystal_I2C .
Again LiquidCrystal_I2C lcd(0x27,16,2); line sets LCD address at 0x27 having 16 columns and 2 rows.
In the below program you can see that, in setup() function we have used init() function inside setup which initializes LCD. Further, backlight() function will turn on back light of LCD.
After setup() function, you will see loop() function in which setCursor(0,0) will bring the cursor at first row first column print()(lcd.print()) function will send output to LCD. delay(1000) statement will hold Name1 on screen for 10 seconds. The same statements are repeated three times, so the final output would be.
First, Name1 will get printed and holds for 10 seconds, then screen will get cleared and sets cursor at (0,0).
Second, Name2 will get printed and holds for 10 seconds, then screen will get cleared sets cursor at (0,0).
Third, Name3 will get printed and holds for 10 seconds, then screen will get cleared sets cursor at (0,0).
#include<Wire.h> #include<LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27,16,2); void setup() { lcd.init(); lcd.backlight();
}
void loop() {
lcd.setCursor(0,0);
lcd.print(“Name1”);
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Name2”);
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Name3”);
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
}