Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MPU6050 SDFileSystem mbed
Revision 0:428ee62e4e8c, committed 2018-06-01
- Comitter:
- tsuyoshi_titech
- Date:
- Fri Jun 01 05:25:18 2018 +0000
- Commit message:
- Hibari
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MPU6050.cpp Fri Jun 01 05:25:18 2018 +0000
@@ -0,0 +1,77 @@
+//include libraries in cpp file
+#include "mbed.h"
+#include "MPU6050.h"
+#include "SDFileSystem.h"
+SDFileSystem sd(PC_12, PC_11, PC_10, PD_2, "sd");
+FILE* fp;
+
+Ticker timer;
+double t=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);
+//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(){
+
+ /*ディレクトリ作成*/
+ mkdir("/sd/test", 0777);
+ /*ファイル作成*/
+ fp = fopen("/sd/test/sensor_log.csv", "w");
+ if(fp == NULL) {
+ error("Could not open file for write\n");
+ }
+ timer.attach(&time,5);
+
+
+ }
+
+
+ /*
+ #include "mbed.h"
+#include "SDFileSystem.h"
+
+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");
+
+ mkdir("/sd/mydir", 0777);
+
+ FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
+ if(fp == NULL) {
+ error("Could not open file for write\n");
+ }
+ fprintf(fp, "Hello fun SD Card World!");
+ fclose(fp);
+
+ printf("Goodbye World!\n");
+}*/
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MPU6050.lib Fri Jun 01 05:25:18 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/moklumbys/code/MPU6050/#9b414412b09e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Fri Jun 01 05:25:18 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/tsuyoshi_titech/code/SDFileSystem/#53ce52c4c90e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 01 05:25:18 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e1686b8d5b90 \ No newline at end of file