MPU-9250 with Kalman Filter
Dependencies: ADXL362-helloworld MPU9250_SPI mbed
Fork of ADXL362-helloworld by
Revision 1:f1e4ee4fc335, committed 2016-05-23
- Comitter:
- mfurukawa
- Date:
- Mon May 23 09:24:25 2016 +0000
- Parent:
- 0:83fda1bfaffe
- Child:
- 2:9ef7a594159c
- Commit message:
- 3 axis dump
Changed in this revision
| ADXL362.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 |
--- a/ADXL362.lib Thu May 19 09:11:04 2016 +0000 +++ b/ADXL362.lib Mon May 23 09:24:25 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/teams/AnalogDevices/code/ADXL362/#2e21c4508cab +http://mbed.org/teams/AnalogDevices/code/ADXL362/#d7a1e4232900
--- a/main.cpp Thu May 19 09:11:04 2016 +0000
+++ b/main.cpp Mon May 23 09:24:25 2016 +0000
@@ -1,19 +1,35 @@
+
#include "mbed.h"
#include "ADXL362.h"
-ADXL362 adxl362(D9);
+Serial pc(USBTX, USBRX);
+
+/*
+ ~CS (Chip Select) p8
+ MOSI (Master Out Slave In) p5
+ MISO (Master In Slave Out p6
+ SCK (Serial Clock) p7
+*/
+ADXL362 adxl362(p8, p5, p6, p7);
int main() {
+ pc.baud(115200);
+
adxl362.reset();
wait_ms(600); // we need to wait at least 500ms after ADXL362 reset
adxl362.set_mode(ADXL362::MEASUREMENT);
uint8_t x,y,z;
+ uint64_t t;
while(1) {
x=adxl362.scanx_u8();
y=adxl362.scany_u8();
z=adxl362.scanz_u8();
- printf("x = %x y = %x z = %x\r\n",x,y,z);
- wait_ms(100);
+ t=adxl362.scan();
+ printf("x = %02x y = %02x z = %02x %04x %04x %04x\r\n",x,y,z,
+ static_cast<uint16_t>(0xFFFF&(t>>48)),
+ static_cast<uint16_t>(0xFFFF&(t>>32)),
+ static_cast<uint16_t>(0xFFFF&(t>>16)) );
+ wait_ms(1);
}
}
Masahiro Furukawa
