Chris Seto
/
MPU6050_noni2cdev
Basic MPU6050 Test Fails
Fork of MPU6050 by
Diff: main.cpp
- Revision:
- 3:1200688738f3
--- /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