Module LM1602 based on PCF8574 popular allows you to connect LCD 2x16, 4x20 or 2x8 to any microcontroller via I2C bus. Through this composition instead of 6 lines (D4, D5, D6, D7, E, RS), we will use only two. Will save valuable output of the Arduino Uno. It is not necessary to connect the potentiometer to adjust the contrast, as it is already on the Board. LM1602 gives us control over the display backlight - we can at any moment turn on and off using the appropriate library functions.
The previously mentioned library can be downloaded from: https://bitbucket.org/fmalpartida. The downloaded file should be unpacked, and then the entire folder LiquidCrystal put in the Arduino libraries directory (libraries), which is located by default in the Documents folder (the default path on Windows 7: C:/Users/ username/Documents/Arduino/libraries).
Downloaded the library has the same name as a standard built into Arduino. So after installing the Arduino software see only the new. In order to return to the standard version, please new folder LiquidCrystal directory from Documents/Arduino/libraries.
After installing the library, with the help of wires, connect the module with Arduino as follows:
Paste on Wednesday following code:
* LCM1602 & Arduino Uno
* VCC - > 5V
* GND - GND
* SCL -> A5
* SDA -> A4
// standard Arduino library
#include <LiquidCrystal_I2C.h> // dolaczenie taken library for I2C LCD
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // setting the addresses of a contract for 0x27
LCD.begin(16,2); // Initialize LCD 2x16
LCD.backlight(); // the following statement podwietlenia
LCD.setCursor(0,0); // sets the cursor at position 0,0 (first row, first column)
LCD.setCursor(0,1); //sets the cursor at position 0,0 (second row, first column)
LCD.backlight(); // the following statement highlighting
LCD.noBacklight(); // disable highlighting
Then wgrywamy code on the plate, and our display will read:
with switching every 5 seconds and lighting.
Bibliteki we use is similar to this built into the Arduino environment