1602 LCD connects to an Arduino |
- Pin V0 LCD potentiometer connected to the middle leg, while each leg on the edge of the potentiometer is connected to VCC and GND. If you later see less clear writing, please turn-turn potentiometer her.
- Pin R / W on the LCD is connected to GND
- Pin RS on the LCD is connected to pin 6 on Arduin
- Pin E on the LCD is connected to pin 7 on Arduino
- Pin to the data (D4 - D7) on the LCD is connected to pin 9 -12 on Arduino
- VDD and A on the LCD connected to + 5v
- VSS and K on the LCD is connected to GND
// Free Tutorial Arduino // www.ioisalman.com #include// Setting LCD RS E D4 D5 D6 D7 LiquidCrystal lcd (7, 6, 9, 10, 11, 12); void setup () { // Select LCD 16 x 2 lcd.begin (16.2); lcd.print ("WWW.IOISALMAN.COM"); } int count = 0; void loop () { // Move to the column line 1 to line 2 // Array always starts from 0 lcd.setCursor (0.1); lcd.print (count ++); delay (1000); }
In Arduino we could use the library to write LCD. The library is LiquidCrystal.h. To use the library you can either include her as the 8th row.
// Setting LCD RS E D4 D5 D6 D7
LiquidCrystal lcd (7, 6, 9, 10, 11, 12);
Command on line 8 is for setting the LCD according to the library is used. Lcd function () is an instance of a class that dipanggila LiquidCrystal on row 8 has a parameter row pin RS, E, D4, D5, D6 and D7. If you want to use a more formal, then you can use some parameter selection as below:
LiquidCrystal(RS, E, D0, D1, D2, D3); LiquidCrystal(RS, RW, E, D0, D1, D2, D3); LiquidCrystal(RS, E, D0, D1, D2, D3, D4, D5, D6, D7); LiquidCrystal(RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7);
Then consider the line of the 12th
// Select LCD 16 x 2 lcd.begin (16.2);
The function begin (column, row, charsize) has two mandatory parameters and 1 additional parameter. Mandatory parameter is the column information and the information line on the LCD. While the additional information is charsize for each character to be used. By default, charsize sized 5x8 pixel for each character, if you have an LCD with a pixel different, please disesuaikan.Fungsi begin () is also used to initialize the LCD type that will be used. Perhaps this is somewhat similar to Serial.begin () function to initialize the serial communication parameters such as baud rate to be used.
// Move to the column line 1 to line 2 // Array always starts from 0 lcd.setCursor (0.1); lcd.print (count ++);
SetCursor function (column, row) is used to move the cursor active with columns and rows that we set. Column-0 means that the column to 1 on the LCD (remember, the first number in the array is 0, not 1), whereas line 1 means is row 2 on the LCD.
In row 21, why use print () instead of System.out.println ()? The use System.out.println () in the LCD will automatically add 2 extra newline characters (CR and LF), then if you use System.out.println (), will appear two strange characters on the LCD. So, use print () to write to the LCD.
0 Response to "The series of LCD Basic Project 1602, and Programs"
Post a Comment