skizziks_53

Reddit 16x2 I2C LCD tester v 1.0

May 22nd, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. /*
  2.    I2C 16x2 example sketch
  3.    April 25, 2019
  4.    Board = uno
  5.    LCD = generic 16-character, 2-line LCD with I2C backpack, purchased off Aliexpress
  6.  
  7.    This is an example sketch to write a message to a 16-character x 2-line LCD that uses the generic I2C backpack.
  8.    I decided to save this because when I went to use one of these LCDs, many of the code examples online didn't work.
  9.    Many of them contained incorrect libraries, and would not compile--yet they appeared to have been copied and pasted from each other.
  10.  
  11.    The web link for this library is as follows:
  12.    https://www.arduinolibraries.info/libraries/liquid-crystal-i2-c
  13.  
  14. */
  15.  
  16. #include "Wire.h" // For I2C
  17. #include "LiquidCrystal_I2C.h" // Library location --- https://www.arduinolibraries.info/libraries/liquid-crystal-i2-c
  18. LiquidCrystal_I2C lcd(0x27, 16, 2); // 0x27 is the default I2C bus address of the backpack-see article
  19.  
  20.  
  21. void setup() {
  22.  
  23.   lcd.init();
  24.   // Print a message to the LCD.
  25.   lcd.backlight();
  26.   lcd.setCursor(0, 0);
  27.   lcd.print("Line #1 ---->end");
  28.   lcd.setCursor(0, 1);
  29.   lcd.print("Line #2 ---->end");
  30. }
  31.  
  32.  
  33. void loop() {
  34.   // This sketch doesn't do anything but print the two lines of text to the LCD)
  35. }
Add Comment
Please, Sign In to add comment