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 mbedTimer SDFileSystem MU2 GPS
Diff: main.cpp
- Revision:
- 0:d0f3991839ec
- Child:
- 1:a8772ca26d1b
diff -r 000000000000 -r d0f3991839ec main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Jul 16 12:10:30 2019 +0000
@@ -0,0 +1,68 @@
+#include "mbed.h"
+#include "MU2.h"
+#include "SDFileSystem.h"
+#include "GPS.h"
+#include <string>
+#include <stdio.h>
+#include <string.h>
+
+
+int main()
+{
+
+ MU2 MuPort(p9,p10);
+ SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
+//(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, "sd")
+ GPS gps(p13,p14);
+ char Message1[128];
+ //char Message2[128];
+
+ Serial pc(USBTX,USBRX);
+ pc.baud(9600);
+
+ FILE* fp;
+
+ while(1) {
+ fp = fopen("/sd/gps/gpsdata.txt", "a");//FILEポインタの宣言
+ if(fp == NULL) {
+ error("Could not open file for write\n");
+ }
+
+ //char Message[]="12345678901234567890";
+ if(gps.getGPGGA()) {
+ int len1=strlen(gps.GPSMessage);
+
+ for(int n=0; n<len1+1; n++) {
+
+ Message1[n]= gps.GPSMessage[n];
+ }
+
+ MuPort.send(Message1);
+ fprintf(fp, "%s\n", Message1);
+ fclose(fp);
+
+ } else {
+ /*
+ int len2=strlen(gps.eGPSMessage);
+
+ char Message2[128];
+ for(int n=0; n<len2+1; n++) {
+ Message2[n]= gps.eGPSMessage[n];
+ }*/
+ char errorMessage[] ="Could not get GPS data!";
+
+
+
+ //pc.printf("Could not get GPS data!");
+
+
+ MuPort.send(errorMessage);
+ fprintf(fp, "%s\n", errorMessage);
+ fclose(fp);
+
+ }
+ wait(1);
+
+
+ }
+}
\ No newline at end of file