The first thing we need is to install the library to allow us to control an LCD over I2C. If you have never installed a library, you can watch this video that shows you how. This time the library we're looking for is the LiquidCrystal_I2C library which looks like this in the Library Manager:
Just search for "LiquidCrystal_I2C" and scroll down until you see the one from Marco Schwartz and click the Install button.
Wiring the LCD only requires four quick connections. The only challenge is that currently, the SDA pin on the Renton Leonardo boards doesn't seem to be working, but this isn't a problem
LCD GND pin --> GND (Black pin on Arduino)
LCD VCC pin --> VCC (Red pin on Arduino)
LCD SDA pin --> D2 (Yellow pin on Arduino)
LCD SCL pin --> D3 (Yellow pin on Arduino)
Note: If the SDA and SCL pins are already occupied, you'll need to use a Breadboard.
Wiring the LCD only requires four quick connections.
LCD GND pin --> GND
LCD VCC pin --> VCC
LCD SDA pin --> SDA
LCD SCL pin --> SCL
Note: If the SDA and SCL pins are already occupied, you'll need to use a Breadboard.
#include <LiquidCrystal_I2C.h> // LCD Library
LiquidCrystal_I2C lcd(0x27, 16, 2); // LCD Declaration, tell the arduino we're using an LCD at I2C address 0x27, 16 column and 2 rows
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
}
void loop()
{
lcd.clear(); // clear LCD display
lcd.setCursor(0, 0); // move cursor to (0, 0)
lcd.print("Renton Schools"); // write message "Renton Schools" at (0, 0) - This is the upper left corner
lcd.setCursor(2, 1); // move cursor to (2, 1) - This is two squares right and one square down from the upper left corner
lcd.print("CTE @RentonCTE"); // print message at (2, 1)
delay(3000); // display the above for three seconds
lcd.clear(); // clear display
lcd.setCursor(2, 0); // move cursor to (2, 0)
lcd.print("Renton Schools"); // print message at (2, 0)
lcd.setCursor(0, 1); // move cursor to (0, 1)
lcd.print("CTE @RentonCTE"); // print message at (0, 1)
delay(3000); // display the above for three seconds
}
There is a potentiometer on the back of the LCD that controls the brightness of the display. This is a small blue box with a grey dial inside. If you install the library, upload the code, and don't see anything on the display, carefully adjust the potentiometer with a screwdriver before trying other solutions. While watching the display, slowly turn the dial all the way one direction, then the other until the words appear.