Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
lakminipasindu
Published © GPL3+

How to use I2c LCD module with arduino

Lot of wires turning to 2 wires

IntermediateFull instructions provided863
How to use I2c LCD module with arduino

Things used in this project

Story

Read more

Schematics

Diagram

Code

arduino code

C/C++
//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);
}

Credits

lakminipasindu

lakminipasindu

3 projects • 0 followers

Comments