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