Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "MSCFileSystem.h"
00003 #include "LIS302.h"
00004 
00005 MSCFileSystem fs("fs"); // Mount flash drive under the name "msc"
00006 
00007 LIS302 acc(p11, p12, p13, p10); // mosi, miso, clk, ncs 
00008 
00009 int main() { 
00010 
00011     FILE *fp = fopen("/fs/acc_data.csv","w");
00012     for (int i = 0; i < 100; i++) { 
00013         fprintf(fp,"%.2f, %.2f, %.2f\n", acc.x(),acc.y(),acc.z()); 
00014         wait(0.1);               
00015     } 
00016     fclose(fp);
00017 }