Challenge

Project 1 - Interfacing a 16*2 LCD with Arduino using I2C protocol

/*1)Interfacing a 16*2 LCD with Arduino using I2C protocol

date: 30/12/2023

Vishnu V Nair*/

#include <LiquidCrystal_I2C.h>

int lcd_Columns= 16; //No of coloumns in LCD

int lcd_Rows= 2; //No of rows in LCD

int I2C_Address= 0x20; //Address of display device

LiquidCrystal_I2C lcd(I2C_Address, lcd_Columns, lcd_Rows); //LCD object with Address, coloumns & rows as parameters

bool messageDisplayed= false;

void setup()

{

lcd.init(); //Initialize the LCD

lcd.backlight(); //Turn on the backlight

}

void loop()

{

//To display message only once

if (!messageDisplayed)

{

lcd.clear(); //Clear display

lcd.setCursor(0, 0); //Set cursor(coloumn, row)

lcd.print("Hello");

lcd.setCursor(0, 1); //Set cursor(coloumn, row)

lcd.print("World");

messageDisplayed = true; //Set the flag true once message is displayed

}

}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.