Saturday 6 April 2024

Arduino and I2C LCD Interfacing

Interfacing I2C LCD with Arduino





Library Needed: LiquidCrystal_I2C



Video: 


Example Code:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();    // initialize the lcd 
  lcd.backlight();  // lcd backlight ON
  lcd.setCursor(0,0);  // 0 row, 0 column
  lcd.print("Thanks for");
  lcd.setCursor(0,1);  // 1 row, 0 column  
  lcd.print("Watching...");    
  delay(2000);

  lcd.clear();
  lcd.setCursor(0,0);  
  lcd.print("Like, Share and Subscribe");
  for (int i=0; i<10; i++)
  {
    delay(400);
    lcd.scrollDisplayLeft();
  }
   delay(1000);
  for (int i=0; i<10; i++)
  {
    delay(200);
    lcd.scrollDisplayRight();
  }     

}

void loop()
{

} 




No comments:

Post a Comment