LCD(Liquid Crystal Display) En: 두 판 사이의 차이

아두위키 : Arduwiki
잔글 (ArduWiki님이 LCD1602 en 문서를 넘겨주기를 만들지 않고 LCD(Liquid Crystal Display) En 문서로 이동했습니다: 철자가 잘못된 제목)
(차이 없음)

2024년 8월 9일 (금) 10:37 판

It's a module for controlling a 16x2 LCD with just four wires via I2C communication.

The I2C address is mostly [0x27], but there are occasional exceptions, so it's recommended to check the address before use.

Specifications and Required Hardware

  • Operating Voltage: 5V
  • 16x2 LCD I2C MODULE
  • Arduino UNO
  • UNO Cable
  • F-M Cable (4ea)

Libraries

  • Wire (No need to install as it's a default library.)
  • LiquidCrystal I2C

Connections

I2C LCD Arduino UNO
GND GND
VCC 5V
SDA A4
SCL A5

How to Check the Address

You can verify the address by uploading the following code and then running the Serial Monitor.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{  
  // Initialize the LCD before use.
  lcd.init();

  // Turn on the LCD backlight.
  lcd.backlight();
  
  // Set the LCD cursor position to (0,0) (top left corner).
  lcd.setCursor(0, 0);

  // Write the text to display.
  lcd.print("Gongzipsa");

  // Move the LCD cursor to position (0,1).
  lcd.setCursor(0, 1);

  // Print the value of val.
  int val = 1004;
  lcd.print(val);
}

void loop(){}

Example Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{  
  // Initialize the LCD before use.
  lcd.init();

  // Turn on the LCD backlight.
  lcd.backlight();
  
  // Set the LCD cursor position to (0,0) (top left corner).
  lcd.setCursor(0, 0);

  // Write the text to display.
  lcd.print("Gongzipsa");

  // Move the LCD cursor to position (0,1).
  lcd.setCursor(0, 1);

  // Print the value of val.
  int val = 1004;
  lcd.print(val);
}

void loop(){}

Example Code Result:

Additional Information

The brightness of the LCD text can be adjusted by controlling the variable resistor.