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