Presentation is loading. Please wait.

Presentation is loading. Please wait.

CTY SAR FCPS Shawn Lupoli, Elliot Tan

Similar presentations


Presentation on theme: "CTY SAR FCPS Shawn Lupoli, Elliot Tan"— Presentation transcript:

1 CTY SAR FCPS Shawn Lupoli, Elliot Tan
Arduino LCD Lab CTY SAR FCPS Shawn Lupoli, Elliot Tan

2 Let’s understand what we are working with…

3 How does the LCD work? Microcontroller has to manipulate several interface pins at once to control the display Register select (RS) pin – controls where in memory you are writing data to Read/Write (R/W) pin – selects reading or writing mode Enable pin – enables writing to registers 8 data pins – states of these pins are the values the LCD is reading Liquid Crystal library allows you to control LCD displays which are compatible with the Hitachi HD44780 driver 16 pin interface Liquid Crystal simplifies two processes Puts data that form the image into the data registers Then puts instructions in the instruction registers

4 Visual of Connecting Arduino to LCD

5 Goal

6 Programming “Hello World” on LCD

7 “Hello World” Part 1 Include all necessary libraries
#include <LiquidCrystal.h> Initializing global variables The LCD itself needs to initialized as a LiquidCrystal object “LiquidCrystal lcd(12, 11, 5, 3, 2)” Setup() lcd.begin(cols, rows) – initializes interface to LCD screen, then specifies the dimensions of the display lcd.print(“Hello, World”) – prints text to the LCD

8 “Hello World” Part 2 Loop() Functions Examples
lcd.setCursor(col, row) – positions the LCD cursor, sets location where subsequent text written to LCD will be displayed Millis() – returns the numer of milliseconds sine the Arduino board began running current program Examples lcd.setCursor(0, 1) – sets cursor to column 0, line 1 lcd.print(millis() / 1000) – prints number of seconds since reset

9 CODE

10 Building the LCD circuit

11 Supplies 1 Arduino Leonardo/Uno board 1 breadboard
6 short wires (2 red, 4 black) 4 medium wires (3 brown, 1 black) 5 long wires (1 red, 4 brown) 1 potentiometer 1 resistor (1 kΩ) 1 LCD * Notes: Wires are 22 or 24 AWG, solid Short wires = 5 cm Medium wires = 12 cm Long wires = 16 cm

12 Diagram of LED Circuit

13 Connecting Code and Circuit

14 Putting it All Together
UPLOAD! Remember to check for the flashing RX and TX lights, and a “Successful upload” message in your console Understanding the process LCD RS pin to digital pin 12 LCD Enable pin to digital pin 11 LCD D4 pin to digital pin 5 LCD D5 pin to digital pin 4 LCD D6 pin to digital pin 3 LCD D7 pin to digital pin 2 LCD R/W pin to ground

15 Troubleshooting Make sure to turn on the Potentiometer!
Make sure all wires are connected to the correct pin! Questions?


Download ppt "CTY SAR FCPS Shawn Lupoli, Elliot Tan"

Similar presentations


Ads by Google