Is there any other way to check it
How about just reporting the elapsed time. Something like
#include "mbed.h"
LocalFileSystem local("local"); // Create the local filesystem under the name "local"
Timer t;
int main() {
time_t starttime = time( NULL );
// Create the file to initialize it, then close it
FILE *fp = fopen( "/local/timefile.dat", "w");
fprintf(fp, "Start of test data./n");
fclose(fp);
// Set a timer and every 60 seconds append the new elapsed time value:
t.start();
while(1) {
while(t.read() < 60);
t.reset();
fopen("/local/timefile.dat", "a");
fprintf(fp,"%d\n", time( NULL ) - starttime;
fclose(fp);
}
}
This should create a single file, "timefile.dat" on the local file system. It then writes a succession of entries, each giving the elapsed time between the start of the test and the instant at which that particular entry was written.
After the mbed power dies, you should be able to plug in the USB cable and use your PC to read the contents of timefile.dat from the USB drive. The last entry will show the total time elapsed.
I haven't tested this - or even compiled it - so some tweaking may be needed.
hth
Hi all,
I used a simple program to test low long the MBED will run on a battery. Hooked it up to a 9V battery. Run the program, and every minute it will write a file to the Mbed. But after the battery was empty, and i've wanted to check the files (hooking the mbed with USB to my computer) , nothing was on the Mbed. Even the program itself was gone ??? I've checked the program first while running on USB. so i know that it will write to the MBED.
heres the program:
Is there any other way to check it. And how do i prevent that the program is getting lost ??? (most important)