// For: https://forum.arduino.cc/t/millis-code-still-freezing-the-lcd-display/1069629/
// This is only a short test.
// See the official example for explanation:
// https://github.com/duinoWitchery/hd44780/blob/master/examples/ioClass/hd44780_I2Cexp/HelloWorld/HelloWorld.ino
//
#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
hd44780_I2Cexp lcd;
// LCD geometry
const int LCD_COLS = 16;
const int LCD_ROWS = 2;
void setup()
{
Serial.begin(115200);
Wire.begin();
int status = lcd.begin(LCD_COLS, LCD_ROWS); // also turn on backlight
if(status) // non zero status means it was unsuccesful
{
Serial.println("Display was not found");
}
lcd.setCursor(0, 0); // column, row
lcd.print( "Hello");
delay(1000);
lcd.clear();
lcd.print( "hd44780");
delay(1000);
}
void loop()
{
// The cheap LCD displays can not dim the backlight,
// therefor the functions backlight() and noBacklight()
// are used instead of the setBacklight().
lcd.backlight(); // turn backlight on.
delay(1000);
lcd.noBacklight(); // turn backlight off.
delay(1000);
lcd.setCursor(0, 1); // column, row
lcd.print( millis() / 1000UL);
}