This blog will provide a tiny library for communicating with the Adafruit Ultimate GPS board from Java SE Embedded. I only implemented UART communication, but it is trivial to adapt the code for use over the USB serial, should you want to. The library provides position information as well as speed, as GGA and VTG was the only info I need (right now). As usual, first install PI4J before attempting to use the library.
Here is how to use the thing:
GPS gps = new GPS();
gps.addListener(new GPSListener() {
@Override
public void onEvent(PositionEvent event) {
System.out.println(event);
}@Override
public void onEvent(VelocityEvent event) {
System.out.println(event);
}
});
Thatโs it. The PositionEvent will provide you with the 2D location, the altitude about mean sea level, the altitude above the ellipsoid, an estimate of the max error, number of satellites used for the fix etc. The VelocityEvent will provide the heading and ground speed. Hope this helps!
Summary
Almost all projects are improved by a GPS. ๐ This tiny library makes it easy to access the Adafruit GPS from Java SE Embedded. Here are the links:
you don’t happen to have a lib built for java8sdk?
Why? ๐