Back to Step by Step Course by Robojax

Lesson 19: Using LCD Screen with Arduino.

Please select other codes for this lecture from the links below.

Related or required files and link to this lesson

Part 2: LCD, LED and OLED Screens

In this lecture we learn how to use LCD screen both 2 line and 4 lines LCD LCD1602 and LCD2004. We first learn about the module, then we learn how to get the I2C addesss for the module, then we lean how to dispaly text on both lines.
A counter example which counts from 0 is shown. Then we learn how to measur the DC voltage from a variable resistor (or potentiometer).

 *  Robojax Arduino Step By Step Course
 * Lesson 19-1  Introduction to LCD 
 * LCD1602-I2C or LCD2004-I2C
 *  This code has been modefied from the Arduino library
   Please watch video instruction here
 This code is available at
with over 100 lectures Free On  YouTube Watch it here
Get the code for the course: 
 *  Updted by Ahmad Shamshiri for Robojax on Dec 30, 2018 at 18;27
 *  in Ajax, Ontario, Canada
 *  This is code for LCD1602 Display with I2C module
 *  which can display text on the screen.
 * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been download from
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <>.
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 or 20 chars and 2 or 4 lines display
LiquidCrystal_I2C lcd(0x3F, 16, 2);

int count =700;
void setup()
  	//Robojax Arduino Step By Step Course
	// initialize the LCD, 
	// Turn on the blacklight and print a message.
  // Robojax code for LCD with I2C


void loop()
    	//Robojax Arduino Step By Step Course
  //start of loop Robojax code for LCD with I2C
  lcd.setCursor (0,0); // set cursor at line 0, char 0
  lcd.setCursor (0,1); // go to start of 2nd line
  lcd.print("Hello World!");

  lcd.setCursor (13,1); // go to start of 2nd line
 //end of loopcode Robojax code for LCD with I2C


The least I expect from you is to give the video a thumbs up and subscribe to my channel. I appreciate it. I have spent hundreds of hours making these lectures and writing code. You don't lose anything by subscribing to my channel. Your subscription is a stamp of approval for my videos, helping more people find them and, in turn, helping me. Thank you!

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal

**** AFFILIATE PROGRAM **** We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to and affiliated sites.

Right Side