I am an old java programmer, translating code from Desktop to Raspberry Pi, with the aim of embedding software in a hardware interface.
I wired a 16*2 character LCD display, which worked with Python code, however when I use pi4j libraries to access the GPIO via Java, the screen is blank.
Am I missing a some binary on/off switch?
I am running pi4j 1.2, on an A+ Pi, got over the 1.1 processor bug that affected wiring Pi.
Thanks for reading, any suggestions are appreciated.
import com.pi4j.component.lcd.LCDTextAlignment;
import com.pi4j.component.lcd.impl.GpioLcdDisplay;
import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.RaspiPin;
import com.pi4j.system.NetworkInfo;
public class LCD {
public static void main(String args[]) {
System.out.println("SYSTEM PRINT TEST");
GpioController gpio = GpioFactory.getInstance();
GpioLcdDisplay lcd = new GpioLcdDisplay(2,16,
RaspiPin.GPIO_26,
RaspiPin.GPIO_31,
RaspiPin.GPIO_15,
RaspiPin.GPIO_16,
RaspiPin.GPIO_01,
RaspiPin.GPIO_04);
lcd.clear();
Thread.sleep(1000);
lcd.write(0, "LINE 1 TEST");
lcd.write(1, "LINE 2 TEST");
Thread.sleep(2000);
gpio.shutdown();
}
}