21:34
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_8 by
MPU9250/sample.txt@0:17f575135219, 2018-09-07 (annotated)
- Committer:
- HARUKIDELTA
- Date:
- Fri Sep 07 04:11:48 2018 +0000
- Revision:
- 0:17f575135219
SBUS_READ
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
HARUKIDELTA | 0:17f575135219 | 1 | //This is a sample code to get pitch, roll, yaw in degree from MPU9250; |
HARUKIDELTA | 0:17f575135219 | 2 | /* |
HARUKIDELTA | 0:17f575135219 | 3 | #include "mbed.h" |
HARUKIDELTA | 0:17f575135219 | 4 | #include "MPU9250.h" |
HARUKIDELTA | 0:17f575135219 | 5 | |
HARUKIDELTA | 0:17f575135219 | 6 | Serial pc(SERIAL_TX,SERIAL_RX); |
HARUKIDELTA | 0:17f575135219 | 7 | MPU9250 mpu9250(pinSDA,pinSCL,&pc); |
HARUKIDELTA | 0:17f575135219 | 8 | |
HARUKIDELTA | 0:17f575135219 | 9 | int main(void){ |
HARUKIDELTA | 0:17f575135219 | 10 | float degrees[3]; |
HARUKIDELTA | 0:17f575135219 | 11 | |
HARUKIDELTA | 0:17f575135219 | 12 | mpu9250.Initialize(); |
HARUKIDELTA | 0:17f575135219 | 13 | |
HARUKIDELTA | 0:17f575135219 | 14 | while(1){ |
HARUKIDELTA | 0:17f575135219 | 15 | mpu9250.sensingPostureAngle(degrees); |
HARUKIDELTA | 0:17f575135219 | 16 | Serial.printf("pitch:%f, roll:%f, yaw,%f\n",degrees[0],degrees[1],degrees[2]); |
HARUKIDELTA | 0:17f575135219 | 17 | } |
HARUKIDELTA | 0:17f575135219 | 18 | } |
HARUKIDELTA | 0:17f575135219 | 19 | */ |