thanks for the reply
as a place to start I have hacked together a few provided sample programs
basically I have tried to get the mbed to write and save a small message in local memory when a condition is satisfied (the voltage on pin 20 is above 0.6). I don't fully understand the way the localfilesystem works, and I guess neither does my computer because I get an infinite string of messages informing me that the mbed device has been disconnected. I assume in trying to satisfy the conditions of the program the device disconnects itself.
I guess I'm asking, what mistakes have I made? Also, is there a hard restart for the mbed to pruge a looping program from memory?
#include "mbed.h"
LocalFileSystem local("local");
AnalogIn myinput(p20);
DigitalOut myled(p5);
int main() {
while(1) {
if(myinput >0.6) {
FILE *fp = fopen("/local/out.txt","w");
fprintf(fp, "hello world");
fclose(fp);
remove("/local/out.txt");
DIR *d = opendir("/local");
struct dirent *p;
while((p = readdir(d)) != NULL){
printf("%s\n", p->d_name);
}
closedir(d);
myled=1;
} else {
myled = 0;
}
}
}
Hi,
It is not clear to me how one would store data from an input (I'm looking to observe voltage) on the mbed. I have not much experience in C, is there a command that will tell the controller to log data after a trigger (say when the voltage jumps above a limit?)
thanks guys