Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GroveGPS-Example by
Revision 1:7239f4aa1605, committed 2018-05-31
- Comitter:
- JimCarver
- Date:
- Thu May 31 16:29:40 2018 +0000
- Parent:
- 0:39b09b3d8731
- Commit message:
- bug
Changed in this revision
--- a/GroveGPS.lib Tue Jan 30 13:47:17 2018 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/users/michaelray/code/GroveGPS/#56d6407653a7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GroveGPS_bug.lib Thu May 31 16:29:40 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/JimCarver/code/GroveGPS_bug/#e3f570014ab4
--- a/main.cpp Tue Jan 30 13:47:17 2018 -0600
+++ b/main.cpp Thu May 31 16:29:40 2018 +0000
@@ -20,34 +20,52 @@
#include "GroveGPS.h"
-Serial gps_serial(D1, D0, 9600);
+extern int GPS_init();
+extern GroveGPS gps;
+Thread gpsThread(osPriorityNormal);
-Thread gpsThread;
-GroveGPS gps;
// Runs at 1Hz and updates the GPS location every second
void gps_updater_thread() {
+ int tt, hours, minutes, seconds, tday;
+ int months[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ printf("Thread Initialized\r\n");
while(true) {
char latBuffer[16], lonBuffer[16];
gps.getLatitude(latBuffer);
gps.getLongitude(lonBuffer);
// Utilize latitude and longitude values here
- printf("Latitude: %f\n, Longitude: %f\n", latBuffer, lonBuffer);
+ printf("\r\nLa=%s Lo=%s\r\n", latBuffer, lonBuffer);
+ tt = gps.gps_zda.utc_time;
+ hours = tt / 10000;
+ tt = tt - (hours*10000);
+ minutes = tt / 100;
+ seconds = tt - (minutes*100);
+ // Correct UTC to PAcific time
+ hours -= 7;
+ tday = gps.gps_zda.day;
+ if(hours < 0) { // UTC Correct
+ hours += 24;
+ tday -= 1;
+ if(!tday) {
+ tday = months[gps.gps_zda.month];
+ }
+ }
+ printf("\r\n%02d", seconds);
wait(1);
}
}
int main() {
-
+ GPS_init();
+ printf("GPS Initialized\r\n");
// Start a thread to get updated GPS values
- gpsThread.start(gps_updater_thread);
+ gpsThread.start(callback(gps_updater_thread));
- // Read the serial bus to get NMEA GPS details
+ // do nothing while the library does all the work
while (true) {
- if (gps_serial.readable()) {
- gps.readCharacter(gps_serial.getc());
- }
+
}
return 0;
--- a/mbed-os.lib Tue Jan 30 13:47:17 2018 -0600 +++ b/mbed-os.lib Thu May 31 16:29:40 2018 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#cf5065c3126210cc7f1132886c22c42d9574bcce +https://github.com/ARMmbed/mbed-os/#c26126ee5951b70703989c844c4d0bc8f498049b
