Skip to content

Instantly share code, notes, and snippets.

@joshuajnoble
Created April 6, 2016 00:31
Show Gist options
  • Save joshuajnoble/03b65ef41ae64f0c308ddb1ae4af5c15 to your computer and use it in GitHub Desktop.
Save joshuajnoble/03b65ef41ae64f0c308ddb1ae4af5c15 to your computer and use it in GitHub Desktop.
#include <TinyGPS.h>
#include <parsegpsBitmap.h>
#include <minitzBitmap.h>
#include <SD.h>
minitzBitmap mb;
//
TinyGPS gps;
void setup() {
// to save space the GPS sensor has to be connected to the
// hardware Serial
Serial.begin(4800);
}
void loop() {
bool newData = false;
while(Serial.available())
{
char c = Serial.read();
if (gps.encode(c)) // Did a new valid sentence come in?
{
newData = true;
}
}
if (newData)
{
File bitmapFile;
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
// put your main code here, to run repeatedly:
int tz = mb.get_timezone(1551155, 155115, 1500, 600, &bitmapFile);
//
int years;
byte months, days, hours, minutes, seconds, hundredths;
unsigned long fix_age;
//
gps.crack_datetime(&years, &months, &days, &hours, &minutes, &seconds, &hundredths, &fix_age);
// minitz has a very particular time/date format it wants
int timetz = seconds + minutes * 100 + hours * 10000;
int date = (years-2000) + months * 100 + days * 10000;
//
int using_dst = mb.apply_timezone(&timetz, &date, tz);
// now you have the timezone, but not much space to do much with it :(
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment