2

Got this device.

enter image description here

enter image description here

Python example char_lcd_plate.py is working perfect.

But I would like to manage it with Pi4J.

I copied bits from python example

LCD_PLATE_RS            = 15
LCD_PLATE_RW            = 14
LCD_PLATE_EN            = 13
LCD_PLATE_D4            = 12
LCD_PLATE_D5            = 11
LCD_PLATE_D6            = 10
LCD_PLATE_D7            = 9

Java:

LCD lcd = new I2CLcdDisplay(2, 16, 1, 0x20, 0, 15, 14, 13, 9, 10, 11, 12);
lcd.clear();
lcd.write(0, "111 ");
lcd.write(1, "222");

Init is fine but I have blue boxes on the screen and no any updates. Any advice?

Update 1

import com.pi4j.component.lcd.LCD;
import com.pi4j.component.lcd.impl.I2CLcdDisplay;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class Display {

    @Scheduled(fixedRate = 30000)
    public void test() throws Exception {
        LCD lcd = new I2CLcdDisplay(2, 16, 1, 0x20, 0, 15, 14, 13, 9, 10, 11, 12);
        lcd.clear();
        lcd.write(0, "111 ");
        lcd.write(1, "222");
    }

}

Links:

How to get pin addresses on a MCP23017

Alex
  • 71
  • 4

0 Answers0