We provide the Hummingbird Java package in three formats: a portable Netbeans project, a portable Eclipse project, and a version that can be used if you prefer compiling from the command line or wish to use a different IDE. All packages are cross-platform:
Java is one of the most-used programming languages in industry today, and is also the language of AP Computer Science and many college introductory courses. Our Java API allows students to use Java to directly read sensors and set motors and LEDs on the Hummingbird.
The software packages include three simple example files:
- BinaryCounter.java – example file that turns the four LEDs attached to Hummingbird into a 16-position binary counter.
- KnobControlledOrbServo.java – example file that changes the color of a tri-color LED on port 1 and the position of a servo on port 1 by reading data from a knob attached to sensor port 1
- OrbFader.java – slowly color cycles the tri-color LEDs
Structure of the Command Line Software Package
The software package folder has three top-level folders:
- libs – Location of the hummingbird and third party libraries
- javadocs – Location of the API documentation
- licenses – Licensing information for the download and for third-party libraries
The example files and several OS specific files are at the top level of the package.
The Hummingbird Java library works with Windows XP/Vista/7/8/10, Mac OS 10.6.8+, and Ubuntu Linux. You must have a Java JDK version 6 or greater installed to compile files. The library may also work with other versions of Linux, but we are only able to provide technical support for Ubuntu.
Currently, debug and error messages print to console, so running a program results in a large amount of text printed as Hummingbird connects and again when a call to disconnect is sent.
On a Mac, you must search for the libhidapi64.dylib and libhidapi32.dylib libraries and copy them into the Mac’s /usr/local/lib directory. To find this directory, select Go/Go to Folder in the Finder. If the directory does not exist, you can create it in Terminal with the following command: sudo mkdir /usr/local/lib