]> git.piffa.net Git - arduino/blob - books/pdummies/Libraries/Adafruit_GPS/examples/flora_dumplog/flora_gpsdump.ino
first commit
[arduino] / books / pdummies / Libraries / Adafruit_GPS / examples / flora_dumplog / flora_gpsdump.ino
1 #include <Adafruit_GPS.h>
2 #include <SoftwareSerial.h>
3 Adafruit_GPS GPS(&Serial1);
4
5 // Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
6 // Set to 'true' if you want to debug and listen to the raw GPS sentences
7 #define GPSECHO  true
8
9 // this keeps track of whether we're using the interrupt
10 // off by default!
11 boolean usingInterrupt = false;
12
13 void setup()  
14
15   while (!Serial);
16   // connect at 115200 so we can read the GPS fast enuf and
17   // also spit it out
18   Serial.begin(115200);
19   Serial.println("Adafruit GPS logging dump test!");
20
21   // 9600 NMEA is the default baud rate for MTK - some use 4800
22   GPS.begin(9600);
23   
24   GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_OFF);
25
26   while (Serial1.available())
27      Serial1.read();
28
29   delay(1000);
30   GPS.sendCommand("$PMTK622,1*29");
31   Serial.println("----------------------------------------------------");
32 }
33
34
35 void loop()                     // run over and over again
36 {  
37   if (Serial1.available()) {
38     char c = Serial1.read();
39       if (c) Serial.print(c);
40   }
41 }