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.
Dependencies: mbed GPS_interrupt
Revision 0:23228856ff9f, committed 2021-06-25
- Comitter:
- imadaemi
- Date:
- Fri Jun 25 12:22:40 2021 +0000
- Commit message:
- 210625_GPS and Ltika
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GPS_interrupt.lib Fri Jun 25 12:22:40 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/PQ_Hybrid_Electrical_Equipment_Team/code/GPS_interrupt/#4b09630703c0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Jun 25 12:22:40 2021 +0000
@@ -0,0 +1,82 @@
+#include "mbed.h"
+#include "GPS_interrupt.h"
+
+Serial pc(USBTX, USBRX, 115200);
+Serial gps_serial(p9, p10, 115200);
+
+GPS_interrupt gps(&gps_serial);
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+bool SetGPS();
+void GetGPS();
+
+float lat, lon, height;
+int num = 0;
+
+int main() {
+
+ pc.printf("Hello GPS!\r\n");
+
+ while(1){
+ if(SetGPS() == 1){
+ break;
+ }
+ }
+
+ while(1){
+ led1 = 0;
+ led2 = 0;
+ led3 = 0;
+ led4 = 0;
+
+ GetGPS();
+
+ if(lat != 0 && lon != 0){
+ switch(num%4){
+ case 1:
+ led1 = 1;
+ break;
+
+ case 2:
+ led2 = 1;
+ break;
+
+ case 3:
+ led3 = 1;
+ break;
+
+ case 0:
+ led4 = 1;
+ break;
+ }
+ }
+
+ num++;
+ wait(0.1);
+ }
+}
+
+bool SetGPS(){
+// gps.changeGPSFreq(10); 入れるとエラーが出る
+ if(gps.gps_readable == true){
+ pc.printf("GPS OK!\r\n");
+ return true;
+ }else if(gps.gps_readable == false){
+ pc.printf("GPS NG...\r\n");
+ return false;
+ }
+// xbee.printf("GPS OK!\r\n");
+// openlog.printf("GPS OK!\r\n");
+}
+
+void GetGPS(){
+ lat = gps.Latitude();
+ lon = gps.Longitude();
+ height = gps.Height();
+ pc.printf("%f\t%f\t%f\t\r\n", lat, lon, height);
+// xbee.printf("%f\t%f\t%f\t\r\n", lat, lon, height);
+// openlog.printf("%f\t%f\t%f\t\r\n", lat, lon, height);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 25 12:22:40 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file