本文介绍了Raspberry Pi 4使用Java控制GPIO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用Java控制树莓派pi4上的16 * 2液晶显示器.问题是Pi4J-用Java修改gpios的解决方案未更新为pi4.还有其他解决方案吗?启动程序时发生此错误:

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控制示例...已启动.玛斯塔无法确定硬件版本.我看到:硬件:BCM2711,

<--Pi4J--> GPIO Control Example ... started. MaistaUnable to determine hardware version. I see: Hardware : BCM2711,

  • 期望BCM2708或BCM2709.如果这是真正的Raspberry Pi,请报告此到[email protected].如果这不是Raspberry Pi,那么您由connectionPi自行设计以支持仅限树莓派.
  • expecting BCM2708 or BCM2709.If this is a genuine Raspberry Pi then please report thisto [email protected]. If this is not a Raspberry Pi then youare on your own as wiringPi is designed to support theRaspberry Pi ONLY.

推荐答案

Pi4J使用WiringPi来控制GPIO.因此,请将此版本更新为2.52,因为该版本支持Raspberry Pi 4,请参见 http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/

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

您可以在我的博客上找到完整的java + pi4j + lcd示例,网址为"> https://webtechie.be/post/2020-01-26-openweathermap-forecast-on-lcd-with-raspberry-pi-java-and -pi4j/

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/

这篇关于Raspberry Pi 4使用Java控制GPIO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 02:54