Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed rijo-mpu6050 MPU6050
rijompu6050.cpp@0:c1875ecb8b79, 2015-10-10 (annotated)
- Committer:
- rijo11811
- Date:
- Sat Oct 10 01:25:32 2015 +0000
- Revision:
- 0:c1875ecb8b79
:)
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| rijo11811 | 0:c1875ecb8b79 | 1 | #include "mbed.h" |
| rijo11811 | 0:c1875ecb8b79 | 2 | #include "MPU6050.h" |
| rijo11811 | 0:c1875ecb8b79 | 3 | Serial thinkdesk(USBTX, USBRX); |
| rijo11811 | 0:c1875ecb8b79 | 4 | int16_t ax, ay, az; |
| rijo11811 | 0:c1875ecb8b79 | 5 | int16_t gx, gy, gz; |
| rijo11811 | 0:c1875ecb8b79 | 6 | MPU6050 mpu(p9,p10); |
| rijo11811 | 0:c1875ecb8b79 | 7 | |
| rijo11811 | 0:c1875ecb8b79 | 8 | |
| rijo11811 | 0:c1875ecb8b79 | 9 | int main() |
| rijo11811 | 0:c1875ecb8b79 | 10 | { |
| rijo11811 | 0:c1875ecb8b79 | 11 | |
| rijo11811 | 0:c1875ecb8b79 | 12 | bool ok ; |
| rijo11811 | 0:c1875ecb8b79 | 13 | ok = mpu.testConnection(); |
| rijo11811 | 0:c1875ecb8b79 | 14 | if(ok) |
| rijo11811 | 0:c1875ecb8b79 | 15 | { |
| rijo11811 | 0:c1875ecb8b79 | 16 | thinkdesk.printf("Test is ok!\n"); |
| rijo11811 | 0:c1875ecb8b79 | 17 | mpu.setSleepMode(0); //THIS WILL GET THE SENSOR OUT OF SLEEP MODE. |
| rijo11811 | 0:c1875ecb8b79 | 18 | } |
| rijo11811 | 0:c1875ecb8b79 | 19 | else |
| rijo11811 | 0:c1875ecb8b79 | 20 | thinkdesk.printf("Test failed!\n"); |
| rijo11811 | 0:c1875ecb8b79 | 21 | float data[3]; |
| rijo11811 | 0:c1875ecb8b79 | 22 | while(1) |
| rijo11811 | 0:c1875ecb8b79 | 23 | { |
| rijo11811 | 0:c1875ecb8b79 | 24 | mpu.getAccelero( data ); |
| rijo11811 | 0:c1875ecb8b79 | 25 | wait(1); |
| rijo11811 | 0:c1875ecb8b79 | 26 | thinkdesk.printf("%f;%f;%f;\n",data[0],data[1],data[2]); |
| rijo11811 | 0:c1875ecb8b79 | 27 | } |
| rijo11811 | 0:c1875ecb8b79 | 28 | } |
| rijo11811 | 0:c1875ecb8b79 | 29 | |
| rijo11811 | 0:c1875ecb8b79 | 30 | |
| rijo11811 | 0:c1875ecb8b79 | 31 | |
| rijo11811 | 0:c1875ecb8b79 | 32 |