Make a USB Device, Control It In Java

Dan Rosenstark picture Dan Rosenstark · Jan 29, 2010 · Viewed 11.2k times · Source

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).

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

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?

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.

How would I get moving on this topic?


1 - No laughter, please.

Answer

R Samuel Klatchko picture R Samuel Klatchko · Jan 29, 2010

The Arduino development environment is written in Java.

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

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").

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.