The Adafruit I2C / SPI character LCD backpack allows you to control these displays by sending data over the two wire I2C interface. Standard LCDs require a large number of digital pins, straining the capability of even an Arduino Uno. Use of the I2C backpack reduces the pins needed considerably.
This project features a 16x2 display, displaying temperature and humidity without using a great deal of memory (important on a small microcontroller like Trinket).
The I2C backpack may be assembled and placed on the back of the display. See the guide to backpack assembly to prepare your display and the backpack.
The color displays have a couple of extra connectors - pins 16, 17, and 18 control the three color backlights. If you connect pin 16, the I2C will control the red light. You can choose to put a jumper from one of the backlight pins to backpack pin 16 to choose a different color or connect the pins high to keep them on all the time. Making the pin choice before soldering on the backpack allows you the most flexibility in choosing your backlight color.
.
Or you can just go with a 'classic' blue & white 16x2 LCD
To test the display, wire the DAT pin to Trinket GPIO #0, the CLK pin to Trinket GPIO #2, 5V to the Trinket 5V line and GND to GND. Use the Fritzing wiring diagram on the previous page to check your wiring.
Ensure your Arduino IDE has been configured to program the Adafruit Trinket 5V 8 MHz for the Hello World test program (note for later: we will be changing this to Trinket 5V 16 MHz for the sensor program).
The display test program is a variation of the Hello World program. You need to install the Adafruit_LiquidCrystal library mentioned on the previous page.
/* Demonstration sketch for Adafruit i2c/SPI LCD backpack using MCP23008 I2C expander and the Trinket mini microcontroller This sketch prints "Hello World!" to the LCD and shows a count in seconds. The circuit: * 5V to Trinket 5V pin * GND to Trinket GND pin * CLK to Trinket pin GPIO #2 * DAT to Trinket pin GPIO #0 */ // include the library code: #include <Adafruit_LiquidCrystal.h> // Connect via i2c, default address #0 (A0-A2 not jumpered) Adafruit_LiquidCrystal lcd(0); void setup() { // set up the LCD lcd.begin(16, 2); // our display has 16 cols, 2 rows lcd.setBacklight(HIGH); // Turn on the backlight lcd.print("hello, world!"); // Print a message to the LCD. } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis()/1000); }