Have you ever wanted to display text in your project? Well, here is a tutorial on how to hookup and use a 16x2 I2C LCD.
Once you gather the materials that are highlighted in the Components and Supplies section, use the circuit image in the Schematics section as a reference to build the basic connection to the I2C LCD. Make sure you put the cables in the correct place / port. At this point you are ready to program the LCD!
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
The program begins with these two libraries. The first is to communicate with the I2C and the second is for the I2C LCD.
LiquidCrystal_I2C lcd(0x27,16,2);
We initialize the I2C LCD library in this part.
void setup() {
lcd.init();
lcd.backlight();
}
In the void setup we start the LCD and the light of this.
void loop() {
lcd.setCursor(0,0);
lcd.print(" Hello, World!!");
lcd.setCursor(0,1);
lcd.print(" 16x2 LCD I2C");
}
In the void loop, we choose the line to write in setCursor and in lcd.print we write our text. Try not to use the ñ as strange things start to come out.
some projects you might like:
https://www.hackster.io/srconta/ping-pong-led-fb38f9
https://www.hackster.io/newproject/happy-birthday-arduino-feliz-cumpleanos-arduino-111265
https://www.hackster.io/newproject/spaceship-command-7e1a5d
Comments
Please log in or sign up to comment.