Back to Arduino Step By Step Course

Lesson 19: Using LCD Screen with Arduino.

If you don't like to see ads while video is being played you can purchase this course for $200 from Udemy

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

Please download required files for this code

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 https://youtu.be/pxUjEsJQW2M
 This code is available at http://robojax.com/course1/?vid=lecture11
 
with over 100 lectures Free On  YouTube Watch it here http://robojax.com/L/?id=338
Get the code for the course: http://robojax.com/L/?id=339 
 *  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 Robojax.com
    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
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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 <https://www.gnu.org/licenses/>.
 */
#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 http://robojax.com/L/?id=338
	// initialize the LCD, 
	lcd.begin();
 
	// Turn on the blacklight and print a message.
	lcd.backlight();
  // Robojax code for LCD with I2C


}

void loop()
{
    	//Robojax Arduino Step By Step Course http://robojax.com/L/?id=338
  //start of loop Robojax code for LCD with I2C
  lcd.clear();
  lcd.setCursor (0,0); // set cursor at line 0, char 0
  lcd.print("Robojax");
  lcd.setCursor (0,1); // go to start of 2nd line
  lcd.print("Hello World!");

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





   

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