How to use I2c LCD module with arduino

0 15212 Medium

Lot of wires turning to 2 wires

projectImage

Things used in this project

 

Hardware components

HARDWARE LIST
DFRobot I2C 16x2 Arduino LCD Display Module
Arduino UNO
Alphanumeric LCD, 16 x 2

Software apps and online services

 

Arduino IDE

 

Microsoft Windows 10 IoT Core

Story

USE THIS LIBRARY BEFORE UPLOAD CODE IN ARDUINO BOARD

 

https://www.udrop.com/file/6htP/LCD_i2c_module.rar

Schematics

 

Diagram

projectImage

Code

CODE
//Edited by arduino tec channel

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//I2C pins declaration
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 
// Make custom characters:
byte speaker[] = {
  B00001,
  B00011,
  B01111,
  B01111,
  B01111,
  B01111,
  B00011,
  B00001
};
byte mug[] = {
  B00000,
  B11100,
  B11111,
  B11101,
  B11101,
  B11110,
  B11100,
  B00000
};
byte tree[] = {
   B01110,
  B11111,
  B11111,
  B11111,
  B01110,
  B00100,
  B00100,
  B00100
};
byte plane[] = {
  B00000,
  B00100,
  B00100,
  B11111,
  B00100,
  B00100,
  B01110,
  B00100
};
byte mouse[] = {
  B00000,
  B00100,
  B01110,
  B01110,
  B01110,
  B11111,
  B00100,
  B00100
};
byte button[] = {
  B10000,
  B11000,
  B11100,
  B11110,
  B11110,
  B11100,
  B11000,
  B10000
};
byte bag[] = {
  B01110,
  B01010,
  B01010,
  B01010,
  B11111,
  B11111,
  B11111,
  B11111
};
byte house[] = {
  B00000,
  B00100,
  B01110,
  B11111,
  B01110,
  B01110,
  B01110,
  B00000
};
void setup() {
  lcd.begin(16, 2);
  lcd.backlight();
  //create new characters
  lcd.createChar(0, speaker);
  lcd.createChar(1, mug);
  lcd.createChar(2, tree);
  lcd.createChar(3, plane);
  lcd.createChar(4, mouse);
  lcd.createChar(5, button);
  lcd.createChar(6, bag);
  lcd.createChar(7, house);
  // Clear the LCD screen:
  lcd.clear();
  // Print a message to the lcd:
  lcd.print("SUB LIKE SHARE");
  //lcd.home();
 // lcd.setCursor(7,0);
  //lcd.write((byte)0);
}
void loop() { 
  // Print all the custom characters:
  lcd.setCursor(0, 1);
  lcd.write((byte)0);
  lcd.setCursor(2, 1);
  lcd.write((byte)1);
  lcd.setCursor(4, 1);
  lcd.write((byte)2);
  lcd.setCursor(6, 1);
  lcd.write((byte)3);
  lcd.setCursor(8, 1);
  lcd.write((byte)4);
  lcd.setCursor(10, 1);
  lcd.write((byte)5);
  lcd.setCursor(12, 1);
  lcd.write((byte)6);
  lcd.setCursor(14, 1);
  lcd.write((byte)7);
}

The article was first published in hackster, April 5, 2022

cr: https://www.hackster.io/lakminipasindu/how-to-use-i2c-lcd-module-with-arduino-a65cf2

author: lakminipasindu

License
All Rights
Reserved
licensBg
0