Skip to content
This repository

Updated to show how to use Standby & Wakeup functions #5

Closed
wants to merge 1 commit into from

2 participants

Austin St. Aubin Limor "Ladyada" Fried
Austin St. Aubin

could put all this into a new file and call it "parsing_with_standby"

Limor "Ladyada" Fried
Owner

mm, id like to keep the standard parsing example the same - if you'd like you can make a new example for showing this code off!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 30, 2012
Austin St. Aubin AustinSaintAubin Updated to show how to use Standby & Wakeup functions, could put all …
…this into a new file and call it "parsing_with_standby"
989b8d8
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 23 additions and 3 deletions. Show diff stats Hide diff stats

  1. +23 3 examples/parsing/parsing.pde
26 examples/parsing/parsing.pde
@@ -57,7 +57,7 @@ void setup()
57 57
58 58 // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
59 59 // also spit it out
60   - Serial.begin(115200);
  60 + Serial.begin(57600);
61 61 Serial.println("Adafruit GPS library basic test!");
62 62
63 63 // 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800
@@ -109,6 +109,7 @@ void useInterrupt(boolean v) {
109 109 }
110 110
111 111 uint32_t timer = millis();
  112 +uint32_t timer2 = millis();
112 113 void loop() // run over and over again
113 114 {
114 115 // in case you are not using the interrupt above, you'll
@@ -139,7 +140,7 @@ void loop() // run over and over again
139 140
140 141 // approximately every 2 seconds or so, print out the current stats
141 142 if (millis() - timer > 2000) {
142   - timer = millis(); // reset the timer
  143 + static boolean inStandby = false;
143 144
144 145 Serial.print("\nTime: ");
145 146 Serial.print(GPS.hour, DEC); Serial.print(':');
@@ -162,6 +163,25 @@ void loop() // run over and over again
162 163 Serial.print("Angle: "); Serial.println(GPS.angle);
163 164 Serial.print("Altitude: "); Serial.println(GPS.altitude);
164 165 Serial.print("Satellites: "); Serial.println((int)GPS.satellites);
  166 +
  167 + if (!inStandby)
  168 + {
  169 + Serial.println("--------------------");
  170 + Serial.println("Have GPS Lock, going to sleep GPS");
  171 + inStandby = GPS.standby();
  172 + Serial.print("Sent Standby Command: ");
  173 + Serial.println(inStandby);
  174 + }
  175 + }
  176 +
  177 + if (inStandby && millis() - timer2 > 10000)
  178 + {
  179 + timer2 = millis(); // reset the timer
  180 + Serial.println("--------------------");
  181 + Serial.print("Waking GPS Up Now: ");
  182 + Serial.println(GPS.wakeup());
  183 + inStandby = false;
165 184 }
  185 +
166 186 }
167   -}
  187 +}

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.