简体   繁体   English

pi4J 适用于橙子派 Plus 2

[英]pi4J For Orange Pi Plus 2

for a school project I recently bought an Orange Pi +2 hoping to use it to control a few electronics with the GPIO pins.为了一个学校项目,我最近买了一个 Orange Pi +2,希望用它来控制带有 GPIO 引脚的一些电子设备。 I have many years of Java experience so I naturally wanted to write my code in that language.我有多年的 Java 经验,所以我很自然地想用那种语言编写我的代码。 When trying to install pi4j which is a java library for raspberry pi I get this error:当尝试为树莓派安装 java 库 pi4j 时,出现此错误:

mackenzie@OrangePI:~$ sudo java -jar LCD.jar
sudo: unable to resolve host OrangePI
Unable to determine hardware version. I see: Hardware   : sun8i,
- expecting BCM2708 or BCM2709. Please report this to projects@drogon.net

I was wondering if anyone had any ports for the Orange Pi and if not I will have to write my program in C. I am running Debian 8 jacer 2 as the os.我想知道是否有人有 Orange Pi 的任何端口,如果没有,我将不得不在 C 中编写我的程序。我正在运行 Debian 8 jacer 2 作为操作系统。

Experimental support for OrangePi is now included in the latest Pi4J v1.2-SNAPSHOT builds.OrangePi实验性支持现在包含在最新的Pi4J v1.2-SNAPSHOT版本中。 Please be aware that this is largely untested at this time.请注意,目前这在很大程度上未经测试。 Feel free to try it out and report issues to the project.请随意尝试并向项目报告问题。

I'm afraid that the WiringPi port for OrangePi (WiringOP) may be slightly outdated and may not support the newer/latest OrangePi hardware models, but more testing is needed to confirm which models are working.我担心OrangePi (WiringOP)WiringPi端口可能会稍微过时并且可能不支持更新/最新的OrangePi硬件模型,但需要更多的测试来确认哪些模型可以正常工作。

I saw this post that may help you : https://groups.google.com/forum/#!topic/pi4j/T30EUL2Z10I我看到这篇文章可能对你有帮助: https : //groups.google.com/forum/#!topic/pi4j/T30EUL2Z10I

As I do not own this device, so I cannot verify by myself.由于我不拥有此设备,因此我无法自行验证。

For Raspberry Pi there is the well-known wiringPi library, written in C, for GPIO access and control.对于 Raspberry Pi,有著名的 WiringPi 库,用 C 编写,用于 GPIO 访问和控制。 This library has been ported for the Orange Pi.该库已被移植到 Orange Pi。 The port is called wiringPO.该端口称为wiringPO。 I wrote a simple Java class with a native method.我用本机方法编写了一个简单的 Java 类。 The native method gives me access to the wiringPO library, and I use JNI to allow my java application to interact with the native method.本机方法使我可以访问wiringPO 库,并且我使用JNI 来允许我的java 应用程序与本机方法进行交互。 Works like a charm.奇迹般有效。

Add the line:添加行:

GpioFactory.setDefaultProvider(new OrangePiGpioProvider());

before getting instance: gpio = GpioFactory.getInstance();获取实例之前: gpio = GpioFactory.getInstance();

the problem is with every orange pi, the problem is with resolv.conf in /etc/resolv.conf.问题出在每个橙色 pi 上,问题出在 /etc/resolv.conf 中的 resolv.conf 上。 do sudo nano /../etc/resolv.conf and then add nameserver 8.8.8.8 to it and control-o to save it做 sudo nano /../etc/resolv.conf 然后添加 nameserver 8.8.8.8 到它和 control-o 保存它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM