Tutorial: Basic 16x2 LCD with Arduino

On this tutorial, we will show you how to connect a basic 16x2 LCD to your Arduino.

Materials List

1x Arduino UNO

1x LCD 16x2

1x Potentiometer 10KΩ

1x Breadboard

Jumper wires

In the LCD datasheet we can check the correct pins of your display.

Connect it like the picture below.

Behind your display, we can see the pin numbers, from 1 to 16. To turn the backlight on, connect the pin 15 to 5V and the 16 to GND.

The Code

#include span style="color: #cc6600;">LiquidCrystal.h> //Include LCDs LibraryLiquidCrystal lcd(12, 11, 5, 4, 3, 2); //Attach LCDs and Arduino pin comunnication 
int time; //Entire variable declaration(time)

void setup()//setup section
{

lcd.begin(16, 2); //LCD begins. dimension: 16x2(Coluns x Rows)
lcd.setCursor(0, 0); // Positions the cursor in the first column (0) and the firt row (1) at LCD
lcd.print("LiquidCrystal.h"); //LCD write comand"LiquidCrystal.h"
lcd.setCursor(0, 1); // Positions the cursor in the first column (0) and the second row (1) at LCD
lcd.print("GarageLab"); // LCD write command "GarageLab"

}

void loop()
{
lcd.setCursor(13, 1); // Positions the cursor on the fourteenth column (13) and the second line (1) LCD
lcd.print(time); // Write the current value of the count variable in the LCD
delay(1000); // Waits for 1 second
time++; // Increment count variable

if(time == 600) // If the variable temp get to 600 (10 minutes), ...
{
time = 0; //... resets the count variable
}

}


Feel free to change the text and see what happens.

References:

http://www.sparkfun.com/datasheets/LCD/GDM1602K.pdf

http://arduino.cc/en/Tutorial/LiquidCrystal

Views: 72652

Comment by HaimaN Adel on January 26, 2013 at 8:41am

thank you

done

this my project

Comment

You need to be a member of GarageLab (arduino, electronics, robotics, hacking) to add comments!

Join GarageLab (arduino, electronics, robotics, hacking)

Latest Activity

iftekhar Mobin is now a member of GarageLab (arduino, electronics, robotics, hacking)
yesterday
Profile IconLeicester Hibbert and Michael Young joined GarageLab (arduino, electronics, robotics, hacking)
Jan 9
Profile IconThorsten Schwarz and Dana Custer joined GarageLab (arduino, electronics, robotics, hacking)
Jan 2
Aqeel munir updated their profile
Dec 31, 2016
Todd Enger updated their profile
Dec 29, 2016
FRANK KWABENA is now a member of GarageLab (arduino, electronics, robotics, hacking)
Dec 28, 2016
Ayhan Chaplan commented on GarageLab's blog post How to use a Peltier with Arduino
"Hi! Will this setup work with a 3,8V / 2,5A Peltier element? Or do I have to reduce the resistance…"
Dec 26, 2016
Profile IconAyhan Chaplan, Erva and Donna Carter joined GarageLab (arduino, electronics, robotics, hacking)
Dec 26, 2016
Galy Huang posted a discussion

Ubuntu on Firefly-RK3399

Firefly-RK3399 with dual-core Cortex-A72 and quad-core Cortex-A53, ARM® Mali-T860 MP4 quad-core…See More
Dec 20, 2016
Chase Rangel posted a discussion

What is the simplest way to control one brushless motor forward/reverse?

  Hello everyone I don't know much about this type of stuff had only a handful of RC cars.I've been…See More
Dec 12, 2016
Profile IconErving Howe, Chase Rangel, Werner Pretorius and 1 more joined GarageLab (arduino, electronics, robotics, hacking)
Dec 12, 2016
Frank Turner is now a member of GarageLab (arduino, electronics, robotics, hacking)
Dec 9, 2016
Marcelo Rodrigues and swapnil are now friends
Dec 6, 2016
Marcelo Rodrigues replied to swapnil's discussion Tiny 85 based Thermometer
"Dear Swapnil, Since you don't have any experience with programming you should consider start…"
Dec 5, 2016
swapnil posted a discussion

Tiny 85 based Thermometer

Hi, can any one guide me how to make the tiny 85 based Thermometer which will glow the LED…See More
Dec 4, 2016
Spyros Svoronos is now a member of GarageLab (arduino, electronics, robotics, hacking)
Dec 4, 2016
K Biju is now a member of GarageLab (arduino, electronics, robotics, hacking)
Nov 29, 2016
Profile Iconswapnil and Yasser joined GarageLab (arduino, electronics, robotics, hacking)
Nov 28, 2016
udit is now a member of GarageLab (arduino, electronics, robotics, hacking)
Nov 25, 2016
Aqeel munir is now a member of GarageLab (arduino, electronics, robotics, hacking)
Nov 23, 2016

© 2017   Created by Marcelo Rodrigues.   Powered by

Badges  |  Report an Issue  |  Terms of Service