Java is one of the most-used programming languages in industry today, and it is also the language of AP Computer Science and many college introductory courses. Our Java library allows students to use Java to read sensors and set motors and LEDs with the Hummingbird Bit.
To use Java with the Hummingbird Bit on a Mac or Windows computer, you must connect to the Hummingbird Bit with the BlueBird Connector using Bluetooth or a USB cord. For Windows, you will need a Bluetooth dongle to use Hummingbird Bit via Bluetooth.
If you are using a Mac, remove the USB cord. You won’t need it to use Java.
If you are using Windows with Bluetooth, remove the USB cord and insert the Bluetooth dongle into a USB port. If are using Windows and don’t have a Bluetooth dongle, just leave the Hummingbird Bit connected to your computer.
Install the BlueBird Connector.
Open the BlueBird Connector. If you are connecting with the USB cord, it will connect automatically to your Hummingbird.
If you are using Bluetooth, you may see one robot or many, depending on how many are nearby. Click on the name of the robot that matches the initials on your device.
You will hear a sound as your device connects, and the initials will stop flashing on the device. The name of your robot should appear under Connected.
Now you are ready to start programming in Java! You can minimize the BlueBird Connector, but you should leave it open the entire time that you are using the Bit. If at any point you have trouble with your robot, you should come back to the BlueBird Connector to check your Bluetooth connection. You can also check your battery level in the BlueBird Connector.
You can use any Java IDE with the Bit. The screenshots here will show Eclipse as an example.
Download and unzip the Java library.
Eclipse will copy four files into your project: the classes for the Hummingbird and micro:bit (Robot.java, Hummingbird.java, and Microbit.java) and a test file (HummingbirdTest.java). Select these files in Eclipse and drag them into the src folder.
Note: If you get an error in Eclipse, right-click on the src folder and select New/Package. Once you create a new package, drag the .java files into that package.
Now you are ready to start writing your own Java programs with the Hummingbird! You can use these videos to help you connect lights, motors, and sensors to your Hummingbird Bit. Once you have some parts connected, use this reference to learn more about what methods are available in the Hummingbird and Microbit classes.
Make sure to store your programs in the Hummingbird project so that they can find the Hummingbird and Microbit classes. If you wish to create a new project, be sure to add the four files in the BitJava folder to the new project.