/ ̄\                |     |                  \_/                  |               /  ̄  ̄ \             /  \ /  \            /   ⌒   ⌒   \            |    (__人__)     |            \    ` ⌒´    /            / ̄ ̄ ̄ ̄ ̄ ̄ ̄ \

Dependencies:   mbed BMP280_SPI ADXL345 MPU9250_SPI GPS FATFileSystem

Files at this revision

API Documentation at this revision

Comitter:
IKobayashi
Date:
Thu Mar 05 05:11:03 2020 +0000
Parent:
3:1bc7fe4442c3
Child:
5:212df3af29ca
Commit message:
LPC_ver3

Changed in this revision

USBDevice.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/USBDevice.lib	Wed Mar 04 09:16:02 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/users/mbed_official/code/USBDevice/#53949e6131f6
--- a/main.cpp	Wed Mar 04 09:16:02 2020 +0000
+++ b/main.cpp	Thu Mar 05 05:11:03 2020 +0000
@@ -1,34 +1,32 @@
 #include "mbed.h"
+#include "SDFileSystem.h"
 #include "MPU9250.h"
 #include "BMP280_SPI.h"
-#include "ADXL345.h"
 #include "GPS.h"
-#include "SDFileSystem.h"
 
+//SDFileSystem sd(p11, p12, p13, p15, "sd");
+SDFileSystem sd(p5, p6, p7, p8, "sd");
 DigitalOut led(LED1);
 GPS gps(p9, p10); // tx, rx
 Serial xbee(p28,p27,38400);
-SPI spi(p5, p6, p7);
-mpu9250_spi imu(spi,p8);   //define the mpu9250 object
-ADXL345 accelerometer(p5, p6, p7, p29);
-BMP280_SPI sensor(p5, p6, p7, p30);
+SPI spi(p11, p12, p13);
+mpu9250_spi imu(spi,p14);   //define the mpu9250 object
+BMP280_SPI sensor(p11, p12, p13, p15);
 Serial pc(USBTX, USBRX);    // tx, rx
-SDFileSystem sd(p11, p12, p13, p14, "sd");
 
 int main()
 {
     int i=0;
-    float readings[3];
 
     mkdir("/sd/data", 0777);
 
     FILE *fp = fopen("/sd/data/sdtest.csv", "w");
     if(fp == NULL) {
-        error("Could not open file for write\n");
+        error("Could not open file for write\r\n");
     }
 
     if(imu.init(1,BITS_DLPF_CFG_188HZ)) { //INIT the mpu9250
-        pc.printf("\nCouldn't initialize MPU9250 via SPI!");
+        pc.printf("\nCouldn't initialize MPU9250 via SPI!\r");
     }
     pc.printf("\nWHOAMI=0x%2x\n\r",imu.whoami()); //output the I2C address to know if SPI is working, it should be 104
     wait(1);
@@ -42,7 +40,6 @@
 
     fprintf(fp,"MPU9250_data, , , , , , , , , ,");
     fprintf(fp,"BMP280_data, ,");
-    fprintf(fp,"ADXL345_data, , ,");
     fprintf(fp,"世界標準時: ,北緯: ,東経: ,状態: ,使用衛星数: ,\r\n");
 
     while (i<30) {
@@ -66,7 +63,7 @@
                   imu.Magnetometer[1],
                   imu.Magnetometer[2]
                  );
-        fprintf(fp,"%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f",
+        fprintf(fp,"%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,%10.3f,",
                 imu.Temperature,
                 imu.gyroscope_data[0],
                 imu.gyroscope_data[1],
@@ -82,9 +79,9 @@
         pc.printf("%2.2f degC, %04.2f hPa\n\r", sensor.getTemperature(), sensor.getPressure());
         fprintf(fp,"%2.2f , %04.2f ,", sensor.getTemperature(), sensor.getPressure());
 
-        accelerometer.read_mg_data(readings);
-        pc.printf("x=%f, y=%f, z=%f\r\n",readings[0],readings[1],readings[2]);
-        fprintf(fp,"%f, %f, %f,",readings[0],readings[1],readings[2]);
+        //accelerometer.read_mg_data(readings);
+        //pc.printf("x=%f, y=%f, z=%f\r\n",readings[0],readings[1],readings[2]);
+        //fprintf(fp,"%f, %f, %f,",readings[0],readings[1],readings[2]);
 
         pc.printf("世界標準時:%02dh%02dm%02ds 北緯:%.8f 東経:%.8f 状態:%d 使用衛星数:%d\r\n",
                   gps.g_hour, gps.g_min, gps.g_sec, gps.g_hokui, gps.g_tokei, gps.rlock, gps.stlgt);
--- a/mbed.bld	Wed Mar 04 09:16:02 2020 +0000
+++ b/mbed.bld	Thu Mar 05 05:11:03 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e1686b8d5b90
\ No newline at end of file