1
\$\begingroup\$

I am trying to program an mbed micro controller to work with a GlobalSat EM 406 GPS receiver and have got it outputting long and lat to a host computer using the information on: https://mbed.org/cookbook/GlobalSat-EM-406-GPS-Module

However I am having trouble getting the mbed to write the data to a text file. When I add the code from: http://mbed.org/handbook/LocalFileSystem it seemingly breaks the code that receives the gps data, as it no longer loops the lat and long to the screen, and instead outputs one instance of zeros, then does nothing else.

Has anyone had any experience with this?

Thanks

The code that works for printing to the screen is:

#include "mbed.h"
#include "GPS.h"
Serial pc(USBTX, USBRX);
GPS gps(p9, p10);
int main() {
while(true) 
{
 if(gps.sample()) 
 {
 pc.printf("%f, %f\r", gps.longitude, gps.latitude);
 } 
 else 
 {
 pc.printf("Oh Dear! No lock :(\n");
 }
}
}

And it breaks when I add:

#include "mbed.h"
#include "GPS.h"
Serial pc(USBTX, USBRX);
GPS gps(p9, p10);
LocalFileSystem local("local"); 
int main() {
while(true) 
{
 if(gps.sample()) 
 {
 pc.printf("%f, %f\r", gps.longitude, gps.latitude);
 FILE *fp = fopen("/local/out.txt", "w"); 
 fprintf(fp, "%f \n", gps.longitude);
 fprintf(fp, "%f \n", gps.latitude);
 fclose(fp);
 } 
 else 
 {
 pc.printf("Oh Dear! No lock :(\n");
 }
}
}
asked May 8, 2014 at 13:38
\$\endgroup\$
0

2 Answers 2

2
\$\begingroup\$

if you read the class documentation you'll see it only works with specific boards https://developer.mbed.org/handbook/LocalFileSystem

Warning

As the FRDM-KL25Z does not have external flash to store files, the LocalFileSystem is not available for this board. It works at the NXP LPC1768 and LPC11U24 only.

answered Jan 12, 2017 at 0:05
\$\endgroup\$
1
\$\begingroup\$

I have now partially fixed this issue. Instead of writing to the internal storage which was problematic, I am now writing to a usb stick using the library from here:

http://mbed.org/users/igorsk/notebook/interfacing-usb-mass-storage-devices-aka-usb-flash/

answered May 11, 2014 at 16:15
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.