LCD 2x16 via ESP32

 Kalau menggunakan ESP32-S3 dengan konfigurasi:

  • SDA → GPIO8
  • SCL → GPIO9
  • LCD 16x2 + modul I2C (PCF8574)

Berikut contoh program sederhana di Arduino IDE untuk menampilkan:

Hallo
ESP32

1. Install Library

Di Arduino IDE buka:

Sketch → Include Library → Manage Libraries

Install: hd44780 by Bill Perry

Library ini lebih modern, lebih stabil, dan bisa otomatis mendeteksi alamat I2C.

Cari di Library Manager:

hd44780

Contoh programnya:

#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>

hd44780_I2Cexp lcd;

void setup() {
  Wire.begin(8, 9);

  lcd.begin(16, 2);
  lcd.backlight();

  lcd.setCursor(0,0);
  lcd.print("Hallo");

  lcd.setCursor(0,1);
  lcd.print("ESP32");
}

void loop() {
}

Kelebihannya:

  • Tidak perlu tahu alamat 0x27 atau 0x3F.
  • Bisa mendeteksi alamat LCD otomatis.
  • Sangat cocok untuk ESP32.


Postingan populer dari blog ini

Perencanaan awal ESP32 S3 testing

winsocket vb.net