ES Experiment No. 04 B-10
ES Experiment No. 04 B-10
B-10
Roll no. – 10
Experiment No. 04
Aim –
To interface LCD with Arduino and display your name.
Software used –
Tinkercad.
Components used –
Arduino Uno, Resistors (220 ohm), Breadboard small, LCD 16x2, Connecting wires.
Procedure –
Open the Tinkercad software.
Create new project.
Select all the components.
Connect the components appropriately.
1. LCD RS pin to digital pin 12.
2. LCD Enable pin to digital pin 11.
3. LCD D4 pin to digital pin 5.
4. LCD D5 pin to digital pin 4.
5. LCD D6 pin to digital pin 3.
6. LCD D7 pin to digital pin 2.
7. LCD R/W pin to GND.
8. LCD VSS pin to GND.
Write the code in the text box.
Click on start simulation.
Once the simulation is started, whatever is wrote in the print statement it will get
displayed on the LCD.
Code –
Code 1 :
#include<LiquidCrystal.h>
void loop()
{
lcd.setCursor(0,0);
lcd.print("
Shravani");
lcd.setCursor(2,1);
lcd.print(" Kadam");
}
Code 2:
#include <LiquidCrystal.h>
lcd.begin(16, 2);
}
void loop()
{
lcd.setCursor(0, 0);
lcd.autoscroll();
lcd.print("Shravani");
delay(500);
}
Output –
Here, is the output (Given input in the print statement) displayed on the LCD.
Here, is the output (whatever is given as an input) displayed on the LCD. Where the output
is scrolling from right to left beca
Commands Used –
#include<LiquidCrystal.h> - We use the LiquidCrystal library for controlling LCD. It is
a LCD library that allows us to interface with LCD.
Void setup() – Use it to initialize variables, pin modes, start using libraries, etc.
Lcd.begin(16,2) - Initializes the interface to the LCD screen, and specifies the
dimensions (width and height) of the display.
Void loop() - The code inside the loop function runs over and over as long as
the Maker Board is turned on.
lcd.setCursor(0,0) - Position the LCD cursor; that is, set the location at
which subsequent text written to the LCD will be displayed.
lcd.print - Prints text to the LCD.
lcd.autoscroll() - Turns on automatic scrolling of the LCD. This causes each
character output to the display to push previous characters over by one space.
Delay(500) - When we do delay(500) our Arduino stops on that line for 0.5 second.
Conclusion –
Hence, we studied the interfacing of LCD with Arduino. In this, we learn about the different
variations to display the output using different commands. In code 1, we displayed the
name without any motion and in code 2, we displayed the name in continuous motion of 0.5
seconds where the output is scrolling from right to left.
***