I2C_TWI_LCD1602_Module__SKU__TOY0046_-DFRobot

Introduction

This is another great LCD display compatible with Gadgeteer modules from DFRobot. With limited pin resources, your project will quicly run out of resources using normal LCDs. With this I2C interface LCD module, you only need 2 lines (I2C)to display the information.If you already have I2C devices in your project, this LCD module actually cost no more resources at all. The adress can be set from 0x20-0x27.Fantastic for Arduino or gadgeteer based projects.

Specification

Contrast Adjust

The contrast can be adjusted by the potential-meter displayed in the following picture.
Toy0046_pinout.jpg

Address Setting

A2 A1 A0 地址
0 0 0 0x20
0 0 1 0x21
0 1 0 0x22
0 1 1 0x23
1 0 0 0x24
1 0 1 0x25
1 1 1 0x26
1 1 1 0x27

Connection Diagram

Connection Diagram

Arduino UNO: connect SDA to Analog pin 5 and SCL to Analog pin 4 on your Arduino. Arduino Leonardo: connect SDA to digital pin 2 and SCL to digital pin 3 on your Arduino.

Library Support Functions

Sample Code

Download Sample code and library

//DFRobot.com
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd

  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop()
{
}

Sample sketch: Control the back light of the I2C LCD1602 Module


#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#if defined(ARDUINO) && ARDUINO >= 100
#define printByte(args)  write(args);
#else
#define printByte(args)  print(args,BYTE);
#endif

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup(){

  lcd.init();                      // initialize the lcd
  lcd.backlight();

  lcd.home();

  lcd.print("Hello world...");
  lcd.setCursor(0, 1);
  lcd.print("dfrobot.com");

}

int backlightState = LOW;
long previousMillis = 0;
long interval = 1000;

void loop(){

  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;

    if (backlightState == LOW)
      backlightState = HIGH;
    else
      backlightState = LOW;

    if(backlightState == HIGH)  lcd.backlight();
    else lcd.noBacklight();
  }
}

Projects

DYP-ME007 Ultrasound range finder - display distance on a I2C 2x16 LCD

DFshopping_car1.png Get I2C/TWI LCD1602 Module from DFRobot Store or DFRobot Distributor.

Category: DFRobot > Sensors & Modules > LCDs, LEDs & Displays category: Product Manual category: DFR Series category: Modules category: LCDs

category: source category: Diagram category: DFRobot

Turn to the Top