Arduino - How to use Liquid Crystal Display I2C
In this article will be How to use Arduino board with Liquid Crystal I2C, It same Arduino Lcd Liquid Crystal Display Examples applications, Arduino boards send text or output from sensor to show on LCD screen. But there is another control unit (PCF8574) to control the screen. This reduces the number of pins to 4 lines.
In this article will be How to use Arduino board with Liquid Crystal I2C, It same Arduino Lcd Liquid Crystal Display Examples applications, Arduino boards send text or output from sensor to show on LCD screen. But there is another control unit (PCF8574) to control the screen. This reduces the number of pins to 4 lines.
Details of PCF8574 (LCD Controller)
- Signal pin (i2c) from Arduino Board
- Potentiometer for adjust Contrast of character
- Address Selector pad
- Black light jumper
Install Library
- go to Library Manager -> Search "LiquidCrystal i2c" -> Install (See more)
Scan I2C Adress of PCF8574 (LCD Controller)
- Check connection and Search Address of PCF8574 (LCD Controller) (See more)
- After find the PCF8574 Address, Take this in Example Code (0x27 or 0x3F)
Example Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
//LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display | |
LiquidCrystal_I2C lcd(0x3f,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display | |
//LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 20 chars and 4 line display | |
void setup() | |
{ | |
lcd.init(); // initialize the lcd | |
// Print a message to the LCD. | |
lcd.backlight(); | |
lcd.setCursor(3,0); | |
lcd.print("Hello, world!"); | |
lcd.setCursor(4,1); | |
lcd.print(" Arduino!"); | |
delay(2000); | |
} | |
void loop() | |
{ | |
lcd.clear(); | |
lcd.print("Hello "); | |
lcd.print(millis()/1000); | |
delay(1000); | |
} |
output program
* If LCD not show characters try adjust the potentiometer
Referent
- https://github.com/marcoschwartz/LiquidCrystal_I2C
Comments
Post a Comment