Commit 3626f853 authored by Markéta Jedličková's avatar Markéta Jedličková
Browse files

GPS test example for OpenCansat library added

parent 47424361
#include <Wire.h>
#include "OpenCansatGPS.h"
#define Serial SerialUSB
OpenCansatGPS gps;
// CONFIG
const uint16_t msDelay = 2000;
void setup()
{
while (!SerialUSB) {}
Serial.begin(57600);
Serial.println("OpenCansat gps test");
gps.begin();
// Uncomment when you wanna see debug prints from library
//gps.debugPrintOn();
}
void loop()
{
uint32_t start = millis();
if (gps.scan(600 * 1000))
{
Serial.println(String(" time to find fix: ") + (millis() - start) + String("ms"));
Serial.println(String(" datetime = ") + gps.getDateTimeString());
Serial.println(String(" lat = ") + String(gps.getLat(), 7));
Serial.println(String(" lon = ") + String(gps.getLon(), 7));
Serial.println(String(" num sats = ") + String(gps.getNumberOfSatellites()));
}
else
{
Serial.println("No Fix");
}
Serial.println(String("Delay: ") + msDelay + String("ms"));
delay(msDelay);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment