2016-08-24 13:24:30 -06:00
|
|
|
/*
|
|
|
|
|
* Author: Jon Trulson <jtrulson@ics.com>
|
|
|
|
|
* Copyright (c) 2016 Intel Corporation.
|
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2016-08-24 13:24:30 -06:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2016-08-24 13:24:30 -06:00
|
|
|
*/
|
|
|
|
|
|
2016-08-25 13:54:49 -06:00
|
|
|
import upm_nmea_gps.NMEAGPS;
|
2016-08-24 13:24:30 -06:00
|
|
|
|
2016-08-25 13:54:49 -06:00
|
|
|
public class NMEAGPS_Example
|
2016-08-24 13:24:30 -06:00
|
|
|
{
|
|
|
|
|
public static void main(String[] args) throws InterruptedException
|
|
|
|
|
{
|
|
|
|
|
// ! [Interesting]
|
|
|
|
|
System.out.println("Initializing...");
|
|
|
|
|
|
2016-08-25 13:54:49 -06:00
|
|
|
// Instantiate a NMEAGPS sensor on uart 0 at 9600 baud with
|
2016-08-24 13:24:30 -06:00
|
|
|
// enable pin on D3
|
2016-08-25 13:54:49 -06:00
|
|
|
NMEAGPS sensor = new NMEAGPS(0, 9600, 3);
|
2016-08-24 13:24:30 -06:00
|
|
|
|
|
|
|
|
// loop, dumping NMEA data out as fast as it comes in
|
|
|
|
|
while (sensor.dataAvailable(5000))
|
|
|
|
|
{
|
|
|
|
|
System.out.print(sensor.readStr(256));
|
|
|
|
|
}
|
|
|
|
|
System.out.println("Timed out");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ! [Interesting]
|
|
|
|
|
}
|
|
|
|
|
}
|