mattjlewis / diozero

Java Device I/O library that is portable across Single Board Computers and microcontrollers. Tested with Raspberry Pi, Odroid C2, BeagleBone Black, Next Thing CHIP, Asus Tinker Board and Arduinos / Pico. Supports GPIO, I2C, SPI as well as Serial communication. Also known to work with Udoo Quad.
https://www.diozero.com
MIT License
261 stars 59 forks source link

Possible bug: HD44780Lcd backlight flashing during text display #116

Closed EAGrahamJr closed 1 year ago

EAGrahamJr commented 1 year ago

Device: HD44780Lcd Connection: PCF8574LcdConnection Hardware: Raspberry Pi 3 Model B Rev 1.2

Running a fairly simple "forever" loop is causing the display to flash on/off:

HD44780Lcd.PCF8574LcdConnection lcdConnection = new HD44780Lcd.PCF8574LcdConnection(1);
HD44780Lcd lcd = new HD44780Lcd(lcdConnection, 16, 2);
while(true) {
    // read the system temperature
    String stringTemp = Files.readAllLines(Paths.get("/sys/class/thermal/thermal_zone0/temp")).get(0);
    float temp = Float.parseFloat(stringTemp) / 1000;
    String time = LocalTime.now().toString();
    time = time.substring(0, time.indexOf('.'));

    lcd.setText(0, String.format("CPU: %.2f",temp);
    lcd.setText(1, time);
    Thread.sleep(1000);
}

Another implementation ported to use the same LcdConnection class did not exhibit this behavior.

I am looking into this issue myself, but didn't want a possible issue to go un-reported. (My hunch is this is related to the strobe timing.)

EAGrahamJr commented 1 year ago

Closing - this is NOT a library issue but rather a hardware issue - e.g. I have a completely different hardware module than the HD44780Lcd supports (GH1602-2502).