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.
main.cpp
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2019 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 */ 00005 00006 #include "mbed.h" 00007 #include "GPS.h" 00008 00009 00010 GPS gps(PG_14, PG_9); 00011 00012 00013 int main() 00014 { 00015 // Initialise the digital pin LED1 as an output 00016 DigitalOut led(LED1); 00017 00018 00019 while (true) { 00020 00021 bool update = gps.updateCheck(); 00022 if (update) { 00023 int time = gps.getTime(); 00024 int latitude = static_cast<int>(gps.getLat() * 100000.0f); 00025 int longitude = static_cast<int>(gps.getLong() * 100000.0f); 00026 int speed = static_cast<int>(gps.getSpeed() * 100.0f); 00027 int hdop = static_cast<int>(gps.getHDOP() * 10.0f); 00028 int sats = gps.getSats(); 00029 00030 printf("time:%d lat:%d long:%d speed:%d hdop:%d sats:%d\r\n", time, latitude, longitude, speed, hdop, sats); 00031 led = !led; 00032 } 00033 ThisThread::sleep_for(100ms); 00034 00035 } 00036 }
Generated on Tue Jul 19 2022 09:12:31 by
1.7.2