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 0:7fe771d8b39a, committed 2017-09-03
- Comitter:
- Joeatsumi
- Date:
- Sun Sep 03 11:54:59 2017 +0000
- Commit message:
- TBT S-240???TP?GPS???
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 7fe771d8b39a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Sep 03 11:54:59 2017 +0000 @@ -0,0 +1,55 @@ +//LPC1768での作動を確認。 +#include "mbed.h" +DigitalOut led(LED1); +LocalFileSystem local("local"); + +//機体に搭載する際には、LPC1768ではなく、LPC1114を使うと思うので、 +//LocalFileSystem ではなく、sdfilesystemを使うといいかも。 + +Serial gps(p9,p10);//9,10ピンをGPSの送受信に用いる。 + +int main(){ + + char rcv[256]; + int count=0; + int log_count=0; + FILE*fp; + + gps.baud(9600); //gpsのボーレート設定 + + + while(1){ + if(gps.readable()){//GPSからの文字を受信したら + + rcv[count]=gps.getc(); + + if(rcv[count]=='$'){//$という文字を受信したら、 + rcv[0]='$'; + count=1; + }else{ + if(rcv[count-1]=='\r'&&rcv[count]=='\n'){ + rcv[count+1]='\0'; + + if(memcmp(rcv, "$GPRMC",6) == 0) {//$GPRMCという文字を10回取得すると記録する。 + + if(log_count >= 10) { + + log_count=0; + led=1; + fp=fopen("/local/nmea.log","a"); + if(fp != NULL){ + fprintf(fp,"%s",rcv); + fclose(fp); + } // if(log_count >= 10) ends + }else{ + led=0; + log_count++; + }//else ends + + } + count =0; + }else{ + count++; + } + } + }}}
diff -r 000000000000 -r 7fe771d8b39a mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Sep 03 11:54:59 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/fd96258d940d \ No newline at end of file