Hd44780 Display

A 2x16 character dot-matrix LCD display with backlight

HD44780 front view HD44780 front view

Connection

HD44780 I²C Arduino
GND GND
VCC 5V
SDA A4 (SDA)
SCL A5 (CLK)

Code

Use the hd44780 library from the Arduino library manager.

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

const int LCD_COLS = 16;
const int LCD_ROWS = 2;

hd44780_I2Cexp lcd;
unsigned long lastMillis = 0;

void setup() {
  lcd.begin(LCD_COLS, LCD_ROWS);
  lcd.clear();
  lcd.setCursor(0, 0); // Column, Row
  lcd.print("Time:");
}

void loop() {
  unsigned long m = millis();
  if (m - lastMillis > 330) {
    lcd.setCursor(6, 0); // Column, Row
    lcd.print(m / 1000);
    lastMillis = m;
  }
}

This page was last edited on 2024-06-28 07:29

Powered by Wiki|Docs

This page was last edited on 2024-06-28 07:29

Bjørn Singer
Private wiki!

Powered by Wiki|Docs