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.
Revision 1:1497469db426, committed 2019-05-23
- Comitter:
- sarahmarshy
- Date:
- Thu May 23 16:18:00 2019 +0000
- Parent:
- 0:39b09b3d8731
- Child:
- 2:c8839c41737b
- Commit message:
- Update GPS library and Mbed OS
Changed in this revision
--- a/GroveGPS.lib Tue Jan 30 13:47:17 2018 -0600 +++ b/GroveGPS.lib Thu May 23 16:18:00 2019 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/michaelray/code/GroveGPS/#56d6407653a7 +https://os.mbed.com/users/sarahmarshy/code/GroveGPS/#0607ba3aa02d
--- a/main.cpp Tue Jan 30 13:47:17 2018 -0600
+++ b/main.cpp Thu May 23 16:18:00 2019 +0000
@@ -1,54 +1,20 @@
-// ----------------------------------------------------------------------------
-// Copyright 2016-2017 ARM Ltd.
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ----------------------------------------------------------------------------
-
#include "mbed.h"
-
#include "GroveGPS.h"
-Serial gps_serial(D1, D0, 9600);
-
-Thread gpsThread;
GroveGPS gps;
-// Runs at 1Hz and updates the GPS location every second
-void gps_updater_thread() {
- while(true) {
- char latBuffer[16], lonBuffer[16];
- gps.getLatitude(latBuffer);
- gps.getLongitude(lonBuffer);
+void read_gps() {
+ 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);
- wait(1);
- }
+ // Utilize latitude and longitude values here
+ printf("\r\nLatitude: %s\r\nLongitude: %s\r\n", latBuffer, lonBuffer);
}
int main() {
-
- // Start a thread to get updated GPS values
- gpsThread.start(gps_updater_thread);
-
- // Read the serial bus to get NMEA GPS details
- while (true) {
- if (gps_serial.readable()) {
- gps.readCharacter(gps_serial.getc());
- }
- }
-
- return 0;
-}
\ No newline at end of file
+ EventQueue queue;
+ queue.call_every(1000, read_gps);
+ gps.start();
+ queue.dispatch();
+}
--- a/mbed-os.lib Tue Jan 30 13:47:17 2018 -0600 +++ b/mbed-os.lib Thu May 23 16:18:00 2019 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#cf5065c3126210cc7f1132886c22c42d9574bcce +https://github.com/ARMmbed/mbed-os/#73f096399b4cda1f780b140c87afad9446047432
Grove GPS