forked from sebzuddas/SunRideUKSEDS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// this is the code branch for GPS location tracking to calculate the final recovery distance from the launchpad | ||
// | ||
//ATTENTION Jamiee: GPS traccking, application, main code | ||
//Program function: | ||
// Location | ||
// Distance from Launchpad | ||
// Estimated Altitude (Cedric/Seb) | ||
|
||
#include <TinyGPS++.h> | ||
#include <AltSoftSerial.h> | ||
|
||
static const int RXPin = 4, TXPin = 3; | ||
static const uint32_t GPSBaud = 9600; | ||
|
||
// The TinyGPS++ object | ||
TinyGPSPlus gps; | ||
|
||
// The serial connection to the GPS device | ||
AltSoftSerial ss(RXPin, TXPin); | ||
|
||
void setup(){ | ||
Serial.begin(9600); | ||
ss.begin(GPSBaud); | ||
} | ||
|
||
void loop(){ | ||
// Achieving values for latitude, longitude and altitude. | ||
while (ss.available() > 0){ | ||
gps.encode(ss.read()); | ||
if (gps.location.isUpdated()){ | ||
Serial.print("Latitude= "); | ||
Serial.println(gps.location.lat(), 6); // Latitude in degrees | ||
Serial.print(" Longitude= "); | ||
Serial.println(gps.location.lng(), 6); // Longitude in degrees | ||
Serial.print("Altitude= "); | ||
Serial.println(gps.altitude.meters()); // Altitude in meters | ||
|
||
// NEED LAUMCH PAD COORDS TO CALCULATE DISTANCE TO ROCKET | ||
} | ||
} | ||
} |