9 years, 6 months ago.

retrieve data from local memory/SDcard

hello everyone

i have learned and tried to write data into local memory and save it in txt format. and i did it. next, i want to try retrieve the saved data and try to send in via xbee. is there any idea to retrieve data from mbed's local memory and send via xbee?

thank you

Question relating to:

1 Answer

9 years, 6 months ago.

Yes. Assuming you used a standard c FILE * to write the file then open the file as read only, exactly the same as you did to write it only "r" rather than "w". And then copy the file to the radio port.

serial radio(Tx,Rx);
FILE *fp = fopen("myFile.txt","r");

if (fp) {
  while (!feof(fp)) {
    radio.putc(fgetc(fp));
  }
  fclose(fp);
}

Accepted Answer

thank you very much for your answer. i'll try that code first :D

posted by Edwar Baihaqi 13 Oct 2014