使用 Java 打开 Arduino 上的 LED [英] Turn on the LED on Arduino with Java
问题描述
我安装了 Java 串行 RXTX 库并正确设置了我的 Arduino.我什至已经启动并运行了示例代码,但我似乎无法理解如何访问不同的 Arduino 引脚以打开 LED 等.如何使用 OutputStream 或任何其他方式访问引脚?
I installed the Java serial RXTX libraries and got my Arduino set up right. I even have the sample code up and running, but I can't seem to understand how to access the different Arduino pins in order to turn a LED for example. How can I access the pins with the OutputStream or any other way?
我是否需要向流发送一些特殊的东西才能告诉它有关特定 pin 的信息?
Do I need to send something special to the stream in order to tell it about a specific pin?
推荐答案
我不确定我的代码的可读性如何,或者安装起来有多容易,但我写了一个小项目,通过 RXTX 与 Arduino 对话.你可以在这里看到我的代码:
I am not sure how readable my code is, or how easily you can install it, but I wrote a small project to talk to the Arduino via RXTX. You can see my code here:
https://github.com/p90puma/SerialToIR
它应该会给你一些想法.
It should give you some ideas.
这三个文件应该为您提供所需的一切:
These three files should give you everything you need:
这篇关于使用 Java 打开 Arduino 上的 LED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!