![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
private
Dependencies: ADXL345 FATFileSystem LPS331_SPI mbed
main.cpp
- Committer:
- obaratakahiro
- Date:
- 2016-09-22
- Revision:
- 0:e9f20ea63046
- Child:
- 1:9dc9b228c5b7
File content as of revision 0:e9f20ea63046:
#include "mbed.h" #include "SDFileSystem.h" #include "LPS331_SPI.h" DigitalOut myled(LED1); LPS331_SPI press(dp2, dp1, dp6, dp26); SDFileSystem sd(dp2, dp1, dp6, dp17, "sd"); int main() { press.quickStart(); int count; while(1){ FILE *fp = fopen("/sd/sdtest.txt", "a"); if(fp == NULL) { error("Could not open file for write\n"); } float pressure; pressure = press.getPressure(); count = fprintf(fp, "%f\r\n",pressure); if ( count < 0 ) { printf("ファイルの書込みに失敗しました.\n"); } fclose(fp); myled = !myled; wait(0.5); } }