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

아두위키 : Arduwiki
편집 요약 없음
104번째 줄: 104번째 줄:
[[File:LCD1602 예제.jpg|center|class=coders100]]
[[File:LCD1602 예제.jpg|center|class=coders100]]


== Additional Information ==
== '''Additional Information''' ==
The brightness of the LCD text can be adjusted by controlling the variable resistor.
The brightness of the LCD text can be adjusted by controlling the variable resistor.
[[File:LCD1602 가변저항.png|center|class=coders50]]
[[File:LCD1602 가변저항.png|center|class=coders50]]

2024년 7월 10일 (수) 14:27 판

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.