Raspberry Pi 4使用Java控制GPIO [英] Raspberry pi 4 controle GPIO with java

查看:590
本文介绍了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. Maista Unable to determine hardware version. I see: Hardware : BCM2711 ,

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

推荐答案

Pi4J使用WiringPi来控制GPIO.因此,请将此版本更新为2.52,因为该版本支持Raspberry Pi 4,请参见

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆