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

  • I would say you need to adjust the contrast – Dirk Jul 30 '18 at 16:56
  • @Dirk I checked contrast. It is fine for python example. – Alex Jul 30 '18 at 18:09
  • can you show your complete code? i think its more a logical problem rather than a programin one, you might be printing the characters fine the first time, but you need a loop to make the refresh, i used to have that problem long a go using another pic – lightshadown Aug 3 '18 at 22:10
  • @lightshadown see "update 1" – Alex Aug 4 '18 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.