Display your results with LCD 🖥️

Updated: May 5, 2020



Know it

LCD is a basic type of display that can display numbers, words, and simple shapes using the Arduino. It's the same display that you can find in old car radios.

Using the LCD with the Arduino is useful to display your results and making communication with the user.


Wire it


Usually connecting an LCD to an Arduino is complicated😧

But if your LCD has a small board on the back (which is an I2C board) it will make it much easier to control the LCD 😃



Connecting an LCD to your Arduino is simple, all you need:

  • 16x2 LCD with I2C board

  • Jumper wires

  • Arduino board and USB connector


Connections:

  • Arduino pin GND LCD GND pin

  • Arduino pin 5V LCD VCC pin

  • Arduino pin A4 LCD SDA pin

  • Arduino pin A5 LCD SCL pin


Code it

This is a simple example sketch that shows you how to display words on both lines of the LCD and how to clear the words after you displayed them.


Come on, it's not that hard:

/*     
Displaying sentences on an LCD screen with I2C

Tutorial link: https://www.learn.voltaat.com/post/lcd-i2c    

This is an sketch that will display two sentences on the 1st line and 2nd line of the lcd, wait for 5 sec, and then write two new sentences, , wait for 5 sec. 

Components Needed:   1. 16x2 LCD (I2C)...x1

Libraries Needed:   1. LiquidCrystal_I2C.h - Download link:   

How to install/use library:

*/

#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(); // start the lcd
lcd.init();

lcd.backlight(); // Turn the backlight on to see the characters better 
}

void loop()
{

lcd.setCursor(2,0); // start displaying after on the 3rd position in the 1st line
  
lcd.print("Hala world!"); // display the sentence between the brackets at the position set in the command before 

lcd.setCursor(0,1); // start displaying after on the 1st position in the 2nd line

lcd.print("Want Karak?"); // display the sentence between the brackets at the position set in the command before 

delay(5000); // keep displaying for 5 sec

lcd.clear(); // clear the display 

lcd.setCursor(0,0); // start displaying after on the 1st position in the 1st line

lcd.print("You can order"); // display the sentence between the brackets at the position set in the command before

lcd.setCursor(0,1); // start displaying after on the 1st position in the 2nd line

lcd.print("on Voltaat!"); // display the sentence between the brackets at the position set in the command before

delay(5000); // keep displaying for 5 sec

}


Learn

Arduino Starter kit

Contact us

Doha, Qatar

Company

© 2020, Voltaat Store for Trading