Permalink
Browse files

set necessary variables that will be filled with GPS data and setup p…

…relim LED time printout. TINYGPS lib is used
  • Loading branch information...
1 parent 19a31e6 commit b9ea06c7b4f2f725e4d9a14721d213d7330e5ecd @kylezoa committed Apr 24, 2011
Showing with 27 additions and 3 deletions.
  1. +27 −3 genaUhr.pde
View
@@ -1,6 +1,8 @@
/*
genaUhr.pde -- main Arduino sketch
+THIS CODE IS UNTESTED AND WRITTEN FROM 'THEORY'
+DO NOT USE
_ _ _
__ _ ___ _ __ __ _| | | | |__ _ __
/ _` |/ _ \ '_ \ / _` | | | | '_ \| '__|
@@ -16,10 +18,9 @@ license, copyright and more information can be found in the README
//NewSoftwareSerial library used for LCD display
#include "lib/NewSoftwareSerial.h"
-//might use TinyGPS, still up for grabs
-/*#include "tinygps/TinyGPS.h"
+//TinyGPS to make data manipulation and later expansion easier
+#include "tinygps/TinyGPS.h"
TinyGPS gps;
-*/
//declaring le *digital* pins to the units
//GPS module (serial TTL)
@@ -43,3 +44,26 @@ void setup() {
serial_lcdDisplay.begin(9600); //start serial for lcdDisplay
}
+
+//reset LED display on initial startup
+Serial.print("v");
+
+//start the long ass loop
+void loop() {
+ //init tinygps magic
+ while (Serial.available())
+ {
+ int c = Serial.read();
+ if (gps.encode(c))
+ { //start the real magic
+
+ //grab time and date information
+ int time = gps.crack_datetime(&hour, &minute); //separating hhmm from ss in order to easily print to LED
+ int seconds = gps.crack_date(&second); //second display will goto LCD
+ int date = gps.crack_datetime(&year, &month, &day);
+
+ //print time to LED
+ Serial.print(time);
+ } //end magic
+ } //end while
+} //end loop

0 comments on commit b9ea06c

Please sign in to comment.