ICM20602_I2C(invensense)---stm32f767zi
Fork of NTOUEE-mbed-I2C_MPU6500 by
Diff: main.cpp
- Revision:
- 2:74690f762c0f
- Parent:
- 1:b8d0e8f53e6c
diff -r b8d0e8f53e6c -r 74690f762c0f main.cpp --- a/main.cpp Wed Oct 26 03:08:46 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/// using NuMaker-PFM-NUC472 I2C0 to read 3-axis accelerometer & 3-axis gyroscope (MPU6500) -#include "mbed.h" -#include "mpu6500.h" - -I2C i2c0(PC_9, PA_15); // I2C0_SDA, I2C0_SCL - -MPU6500 IMU; // on-board IMU is MPU6500 - -int main() { - int16_t accX, accY, accZ; - int16_t gyroX, gyroY, gyroZ; - - i2c0.frequency(400000); - IMU.initialize(); - - while(true) { - accX = IMU.getAccelXvalue(); - accY = IMU.getAccelYvalue(); - accZ = IMU.getAccelZvalue(); - gyroX= IMU.getGyroXvalue(); - gyroY= IMU.getGyroYvalue(); - gyroZ= IMU.getGyroZvalue(); - printf("Acc: %6d, %6d, %6d, ", accX, accY, accZ); - printf("Gyro:%6d, %6d, %6d\n\r", gyroX, gyroY, gyroZ); - } -}