Chris Seto
/
MPU6050_noni2cdev
Basic MPU6050 Test Fails
Fork of MPU6050 by
Revision 3:1200688738f3, committed 2014-07-02
- Comitter:
- chris1seto
- Date:
- Wed Jul 02 14:42:46 2014 +0000
- Parent:
- 2:5c63e20c50f3
- Commit message:
- Basic test. Fails STM32F103RB
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5c63e20c50f3 -r 1200688738f3 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jul 02 14:42:46 2014 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#include "MPU6050.h" + +MPU6050 mpu(I2C_SDA, I2C_SCL); +Serial pc(SERIAL_TX, SERIAL_RX); + +int main() +{ + pc.baud(115200); + pc.printf("Alive!\r\n"); + + if (mpu.testConnection()) + { + pc.printf("Connection OK!\r\n"); + } + else + { + pc.printf("Connect fail\r\n"); + } + + mpu.setSleepMode(false); + mpu.setAcceleroRange(MPU6050_ACCELERO_RANGE_2G); + + while (1) + { + pc.printf("%d\r\n", mpu.getAcceleroRawX()); + wait(.5); + + } + + +} \ No newline at end of file
diff -r 5c63e20c50f3 -r 1200688738f3 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jul 02 14:42:46 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae \ No newline at end of file