Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 9 months ago.
Save sensors data to SD
Hi, i have questions about save data to SD.i use LPC4088 board. Could someone can give me an example to let me know clearly? And i would like to save bit file to SD. Just like Hex. Thanks very much!!!!! Thanks! These are sensors below.
#include "mbed.h" void sensorA(); void sensorB(); void sensorC(); int main(){ sensorA(); sensorB(); sensorC(); }
1 Answer
8 years, 9 months ago.
SD interface = SPI interface.
You should be able to use the following mbed code for your project:
https://developer.mbed.org/teams/mbed/code/SDFileSystem/
// Access the filesystem on an SD Card using SPI #include "mbed.h" #include "SDFileSystem.h" // change the port pins to suit the SPI port pins on your target board SDFileSystem sd(p5, p6, p7, p12, "sd"); // mosi, miso, sclk, cs int main() { FILE *fp = fopen("/sd/myfile.txt", "w"); fprintf(fp, "Hello World!\n"); fclose(fp); }