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: SDFileSystem mbed
Fork of mbed_GPS_TP by
Diff: main.cpp
- Revision:
- 1:ac509e6b8e61
- Parent:
- 0:7fe771d8b39a
--- a/main.cpp Sun Sep 03 11:54:59 2017 +0000
+++ b/main.cpp Mon Sep 11 01:02:14 2017 +0000
@@ -1,12 +1,16 @@
//LPC1768での作動を確認。
#include "mbed.h"
+#include "SDFileSystem.h"
+
DigitalOut led(LED1);
-LocalFileSystem local("local");
+//LocalFileSystem local("local");
+SDFileSystem sd(p5, p6, p7, p8, "sd");
//機体に搭載する際には、LPC1768ではなく、LPC1114を使うと思うので、
//LocalFileSystem ではなく、sdfilesystemを使うといいかも。
Serial gps(p9,p10);//9,10ピンをGPSの送受信に用いる。
+Serial pc(USBTX,USBRX);
int main(){
@@ -23,6 +27,7 @@
rcv[count]=gps.getc();
+
if(rcv[count]=='$'){//$という文字を受信したら、
rcv[0]='$';
count=1;
@@ -30,13 +35,14 @@
if(rcv[count-1]=='\r'&&rcv[count]=='\n'){
rcv[count+1]='\0';
- if(memcmp(rcv, "$GPRMC",6) == 0) {//$GPRMCという文字を10回取得すると記録する。
+ if(memcmp(rcv, "$GPRMC",6) == 0) {//$GPRMCという文字を1回取得すると記録する。
- if(log_count >= 10) {
+ if(log_count >= 1) {
log_count=0;
- led=1;
- fp=fopen("/local/nmea.log","a");
+ led=1;
+ mkdir("/sd/mydir", 0777);
+ fp=fopen("/sd/mydir/nmea.log","a");
if(fp != NULL){
fprintf(fp,"%s",rcv);
fclose(fp);
