fuck2

Dependencies:   HMC5883L MPU6050 SDFileSystem_fuck mbed

Fork of SDFileSystem_HelloWorld by mbed official

Files at this revision

API Documentation at this revision

Comitter:
tsuyoshi_titech
Date:
Fri Jun 01 10:55:46 2018 +0000
Parent:
1:e4d7342be507
Commit message:
g

Changed in this revision

HMC5883L.lib Show annotated file Show diff for this revision Revisions of this file
MPU6050.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r e4d7342be507 -r 1dba0fce299c HMC5883L.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HMC5883L.lib	Fri Jun 01 10:55:46 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/tylerjw/code/HMC5883L/#bc4e1201e092
diff -r e4d7342be507 -r 1dba0fce299c MPU6050.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPU6050.lib	Fri Jun 01 10:55:46 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/moklumbys/code/MPU6050/#9b414412b09e
diff -r e4d7342be507 -r 1dba0fce299c SDFileSystem.lib
--- a/SDFileSystem.lib	Tue May 16 05:18:55 2017 +0000
+++ b/SDFileSystem.lib	Fri Jun 01 10:55:46 2018 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/SDFileSystem/#8db0d3b02cec
+https://os.mbed.com/users/tsuyoshi_titech/code/SDFileSystem_fuck/#d97d2a7437a0
diff -r e4d7342be507 -r 1dba0fce299c main.cpp
--- a/main.cpp	Tue May 16 05:18:55 2017 +0000
+++ b/main.cpp	Fri Jun 01 10:55:46 2018 +0000
@@ -1,7 +1,87 @@
+//include libraries in cpp file
 #include "mbed.h"
+#include "MPU6050.h"
+#include "SDFileSystem.h"
+#include "HMC5883L.h"
+SDFileSystem sd(PC_12, PC_11, PC_10, PD_2, "sd");
+FILE* fp;
+Timer t;
+//Ticker timer;
+double n=0;
+//creating an object of serial class
+//so that we can communicate with PC
+Serial pc(SERIAL_TX, SERIAL_RX);
+//setting LED1 to give digital output
+DigitalOut myled(LED1);
+//creating onject of MPU6050 class
+MPU6050 ark(PB_9,PB_8);
+HMC5883L MG(PB_9,PB_8);
+//int main()
+/*void time()
+{       
+        reading Temprature
+        float temp = ark.getTemp();
+        pc.printf("temprature = %0.2f ^C\r\n",temp);
+        
+        //reading Grometer readings
+        float gyro[3];
+        ark.getGyro(gyro);
+        //pc.printf("Gyro0=%f,\tGyro1=%f,\tGyro2=%f\r\n",gyro[0],gyro[1],gyro[2]);
+        
+        //reading Acclerometer readings
+        float acce[3];
+        ark.getAccelero(acce);
+        //pc.printf("Acce0=%f,Acce1=%f,Acce2=%f\r\n",acce[0],acce[1],acce[2]);
+        //pc.printf("%f,%f,%f,%f,%f,%f,%f\r\n",acce[0],acce[1],acce[2],gyro[0],gyro[1],gyro[2]);
+          pc.printf("t=%f\r\n",t);
+         t+=5;
+        fprintf(fp,"%f,%f,%f,%f,%f,%f,%f\r\n",acce[0],acce[1],acce[2],gyro[0],gyro[1],gyro[2]);
+        if(t>=(20)){
+            timer.detach();
+            fclose(fp);
+            printf("Goodbye World!\n");  
+        }
+    }
+*/    
+int main(){
+    pc.printf("start\r\n");
+      /*ディレクトリ作成*/
+    mkdir("/sd/test", 0777);
+      /*ファイル作成*/
+    fp = fopen("/sd/test/sensor_log_AGM.csv", "wb");
+    
+    t.start();
+    if(fp == NULL) {
+        error("Could not open file for write\n");
+    }
+    //timer.attach(&time,5);
+    while(1){
+    float gyro[3];
+    ark.getGyro(gyro);
+    float acce[3];
+    ark.getAccelero(acce);
+    int16_t Mg[3];
+    MG.getXYZ(Mg);
+    n+=0.01;
+    fprintf(fp,"%f,%f,%f,%f,%f,%f,%d,%d,%d\r\n",acce[0],acce[1],acce[2],gyro[0],gyro[1],gyro[2],Mg[0],Mg[1],Mg[2]);
+    wait(0.01);
+    if(n>=(60)){
+        //timer.detach();
+        t.stop();
+        fprintf(fp,"t=%f",t.read_ms());
+        fclose(fp);
+        printf("Goodbye World!\r\n");  
+        break;
+    }
+    }
+    }
+    
+    
+    /*
+    #include "mbed.h"
 #include "SDFileSystem.h"
  
-SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
+SDFileSystem sd(PC_12, PC_11, PC_10, PD_2, "sd"); //CMD(MOSI),DAT0(MISO),CLK(CSK),CD/DAT3(CS)
  
 int main() {
     printf("Hello World!\n");   
@@ -16,4 +96,4 @@
     fclose(fp); 
  
     printf("Goodbye World!\n");
-}
+}*/
\ No newline at end of file