Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- I2C 16x2 example sketch
- April 25, 2019
- Board = uno
- LCD = generic 16-character, 2-line LCD with I2C backpack, purchased off Aliexpress
- This is an example sketch to write a message to a 16-character x 2-line LCD that uses the generic I2C backpack.
- I decided to save this because when I went to use one of these LCDs, many of the code examples online didn't work.
- Many of them contained incorrect libraries, and would not compile--yet they appeared to have been copied and pasted from each other.
- The web link for this library is as follows:
- https://www.arduinolibraries.info/libraries/liquid-crystal-i2-c
- */
- #include "Wire.h" // For I2C
- #include "LiquidCrystal_I2C.h" // Library location --- https://www.arduinolibraries.info/libraries/liquid-crystal-i2-c
- LiquidCrystal_I2C lcd(0x27, 16, 2); // 0x27 is the default I2C bus address of the backpack-see article
- void setup() {
- lcd.init();
- // Print a message to the LCD.
- lcd.backlight();
- lcd.setCursor(0, 0);
- lcd.print("Line #1 ---->end");
- lcd.setCursor(0, 1);
- lcd.print("Line #2 ---->end");
- }
- void loop() {
- // This sketch doesn't do anything but print the two lines of text to the LCD)
- }
Add Comment
Please, Sign In to add comment