Reputation: 31
I want to controle a 16*2 lcd display on my raspberry pi4 with java. The problem is that Pi4J - the solution to modify the gpios with java is not updated to pi4. Is there another solution? This error occures when I start the programm:
pi@raspberrypi:~/desktop/gpio $ sudo ./start.sh
<--Pi4J--> GPIO Control Example ... started. Maista Unable to determine hardware version. I see: Hardware : BCM2711 ,
Upvotes: 3
Views: 1756
Reputation: 46
I found out the reason it was not working for me, is that sudo dpkg -i wiringpi-latest.deb
installs gpio in /usr/bin/gpio
but there was another gpio file in /usr/local/bin/gpio
which was taking precedence. You can find if this is the case for you by running which gpio
.
I renamed the old file from gpio
to gpio.old
(I did not want to delete it, just in case) and executed sudo dpkg -i wiringpi-latest.deb
again. Now when I run which gpio
I find the correct executable.
Upvotes: 0
Reputation: 6687
Pi4J uses WiringPi to control the GPIOs. So please update it to version 2.52 as this one supports the Raspberry Pi 4, see http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/
$ gpio -v
gpio version: 2.50
$ cd /tmp
$ wget https://project-downloads.drogon.net/wiringpi-latest.deb
$ sudo dpkg -i wiringpi-latest.deb
$ gpio -v
gpio version: 2.52
You can find a full java+pi4j+lcd example on my blog on https://webtechie.be/post/2020-01-26-openweathermap-forecast-on-lcd-with-raspberry-pi-java-and-pi4j/
Upvotes: 5