制作一个 USB 设备,用 Java 控制它 [英] Make a USB Device, Control It In Java

查看:30
本文介绍了制作一个 USB 设备,用 Java 控制它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑制作带有旋钮、按钮和 LED 的物理控制器(设备?).我想使用 Java 与它交互(响应旋钮、点亮 LED 等).我提到 Java 的原因有两个:首先,我很了解 Java1.其次,我已经用 Java 编写了我需要与之交互的其余程序(尽管有一些方法可以用另一种语言与 Java 程序对话).

I'm thinking about making a physical controller (device?) with knobs, buttons, and LEDs. I'd like to interact with it using Java (respond to the knobs, light up LEDs, etc). The reason I mention Java is two-fold: first, I know Java well1. Second, I've written the rest of the program I need to interface with in Java (though there are ways to talk to the Java program from another language).

我希望设备通过 USB 连接并且独立于(计算机)平台.

I would like the device to connect via USB and be (computer-)platform independent.

我不知道从哪里开始,除了开始阅读 Arduino 网站.这是我最好/唯一的选择吗?有没有更适合与 Java 通信的东西?

I haven't the slightest idea of where to start, except to start reading the Arduino website. Is this my best/only option? Is there something better suited for communicating with Java?

注意:我知道 Arduino 与 Java 有某种关系(不确定是什么),但似乎代码必须用 C 的子集编写.

Note: I know that Arduino has something to do with Java (not sure what), but it seems like code must be written in a subset of C.

我将如何继续讨论这个话题?


1 - 请不要笑.

推荐答案

Arduino 开发环境是用 Java 编写的.

The Arduino development environment is written in Java.

但是您为 Arduino 平台编写程序的标准语言实际上是 C++.

But the standard language you write a program for the Arduino platform is effectively C++.

Arduino 平台基于 Atmel AVR 芯片.至少有一个 用于 AVR 芯片的 Java VM.AVR 还有其他可用的语言,例如 Forth 和 BASIC(虽然我只能找到商业版本,所以我'如果你想找到它们,搜索AVR BASIC").

The Arduino platform is based on an Atmel AVR chip. There is at least one Java VM for AVR chips. There are other languages available for the AVR such as Forth and BASIC (although I could only find commercial versions, so I'll if you want to find them, search for "AVR BASIC").

Arduino 使用虚拟 COM 端口在主机和它之间进行通信.虚拟 COM 端口模拟旧式串行线,但使用 USB 完成.您可以使用 Java 通信 API 然后让运行在主机上的 Java 程序与您的物理设备.

The Arduino uses a virtual COM port to communicate between the host computer and it. A virtual COM port emulates an old style serial line but is done with USB. You can use the Java communication API to then have a Java program running on the host computer communicate with your physical device.

这篇关于制作一个 USB 设备,用 Java 控制它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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