SetCursor() method
LCD means Liquid Crystal Display. We use LCD technology everyday in Watches, digicode
display, and so on . Look around you, and check these small or great LCDs. There exist two big families of LCD display:
* Character LCD is based on a matrix of characters (columns x rows)
* Graphical LCD , is based on a pixel matrix
We can find a lot of printed circuit boards that include an LCD and the connectors to interface them with Arduino and other systems for cheap , nowadays.
There is now a library included in the Arduino Core that is really easy to use. Its name is Liquid Crystal, and it works with all LCD displays that are compatible with the Hitachi HD44780 Driver. This driver is really common .
Hitachi developed it as a very dedicated driver, that includes a micro-controller itself, specifically to driver alphanumeric characters LCDs and to connect to the external world easily too, which can be done by a specific link using, usually, 16 connectors, including power supply for the external circuit itself and the backlight supply too:
display, and so on . Look around you, and check these small or great LCDs. There exist two big families of LCD display:
* Character LCD is based on a matrix of characters (columns x rows)
* Graphical LCD , is based on a pixel matrix
We can find a lot of printed circuit boards that include an LCD and the connectors to interface them with Arduino and other systems for cheap , nowadays.
There is now a library included in the Arduino Core that is really easy to use. Its name is Liquid Crystal, and it works with all LCD displays that are compatible with the Hitachi HD44780 Driver. This driver is really common .
Hitachi developed it as a very dedicated driver, that includes a micro-controller itself, specifically to driver alphanumeric characters LCDs and to connect to the external world easily too, which can be done by a specific link using, usually, 16 connectors, including power supply for the external circuit itself and the backlight supply too:
Commponent required
- Arduino or Genuino Board
- 16*2 LCD
- 10k ohm potentiometer
- 220 ohm resistor
- Jumper wire
- Breadboard
Circuit diagram
connection to lcd and arduino
The circuit:
* 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
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
code
#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// these constants won't change. But you can change the size of
// your LCD using them:
const int numRows = 2;
const int numCols = 16;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(numCols, numRows);
}
void loop() {
// loop from ASCII 'a' to ASCII 'z':
for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) {
// loop over the columns:
for (int thisRow = 0; thisRow < numRows; thisRow++) {
// loop over the rows:
for (int thisCol = 0; thisCol < numCols; thisCol++) {
// set the cursor position:
lcd.setCursor(thisCol, thisRow);
// print the letter:
lcd.write(thisLetter);
delay(200);
}
}
}
}

Comments
Post a Comment