DESCRIPTION:
This is an 16×2 LCD display screen with I2C interface. It is able to display 16×2 characters on 2 lines, white characters on blue background.
Usually, Arduino LCD display projects will run out of pin resources easily, especially with Arduino Uno. And it is also very complicated with the wire soldering and connection.
This I2C 16×2 Arduino LCD Screen is using an I2C communication interface. It means it only needs 4 pins for the LCD display: VCC, GND, SDA, SCL. It will saves at least 4 digital / analog pins on Arduino. All connector are standard XH2.54 (Breadboard type). You can connect with jumper wire directly.
Features:
- Compatible with Arduino 4 line control module.
- You can use the Arduino official Library directly.
- With backlights and contrast regulator potentiometers.
- Support I2C protocol.
- Dimension: 23 x 41 mm
- Charging voltage: 5v
I2C Address Scanner Code:
// I2C Scanner // Written by Nick Gammon // Date: 20th April 2011 #include <Wire.h> void setup() { Serial.begin (9600); Serial.println ("I2C scanner. Scanning ..."); byte count = 0; Wire.begin(); for (byte i = 8; i < 120; i++) { Wire.beginTransmission (i); if (Wire.endTransmission () == 0) { Serial.print ("Found address: "); Serial.print (i, DEC); Serial.print (" (0x"); Serial.print (i, HEX); Serial.println (")"); count++; delay (1); // maybe unneeded? } // end of good response } // end of for loop Serial.println ("Done."); Serial.print ("Found "); Serial.print (count, DEC); Serial.println (" device(s)."); } // end of setup void loop() {}
The code
The LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE) init the library, change the LCD I2C address, try 0x27 if it’s not working.
The lcd.begin(16,2) command set up the LCD number of columns and rows. For example, if you have an LCD with 20 columns and 4 rows (20×4) you will have to change this to lcd.begin(20×4).
The lcd.print(“–message–“) command print a message to first column and row of lcd display. The “message” must have maximum length equal to lcd columns number. For example, for 16 columns display max length is equal with 16 and for 20 columns display max length is equal with 20.
â
The lcd.setCursor(0,1) command will set cursor to first column of second row. If you have an LCD 20×4 and you want to print a message to column five and third row you have to use: lcd.setCursor(4,2).
/* I2C LCD 16x2 Arduino Tutorial * More info http://www.ardumotive.com/i2clcd(en).html * Dev: Michalis Vasilakis Date: 19/11/2016 Ver. 1.0 */ //Libraries #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address, if it's not working try 0x27. void setup(){ lcd.begin(16,2); // iInit the LCD for 16 chars 2 lines lcd.backlight(); // Turn on the backligt (try lcd.noBaklight() to turn it off) lcd.setCursor(0,0); //First line lcd.print("I2C LCD Tutorial"); lcd.setCursor(0,1); //Second line lcd.print("*ONLINE-COMPONENTS*"); } void loop(){ }
Reviews
There are no reviews yet.