Program for testing development of BMI160 Library
Dependencies: BMI160 max32630fthr mbed
Diff: main.cpp
- Revision:
- 3:250503cb7cb3
- Parent:
- 2:0d7433075663
- Child:
- 4:3d7fae7f7b75
diff -r 0d7433075663 -r 250503cb7cb3 main.cpp --- a/main.cpp Tue Dec 20 00:11:10 2016 +0000 +++ b/main.cpp Tue Dec 20 01:30:12 2016 +0000 @@ -52,6 +52,7 @@ DigitalOut bLED(LED3, LED_ON); I2C i2cBus(P5_7, P6_0); + i2cBus.frequency(400000); BMI160_I2C imu(i2cBus, BMI160_I2C::I2C_ADRS_SDO_LO); imu.setSensorPowerMode(BMI160::GYRO, BMI160::NORMAL); @@ -59,19 +60,22 @@ imu.setSensorPowerMode(BMI160::ACC, BMI160::NORMAL); wait_ms(100); - float imuTemperature; + float imuTemperature, sensorTime; BMI160::SensorData accData; //BMI160::SensorData gyroData; while(1) { + imu.getAccXYZ(accData, BMI160::DEFAULT_ACC_CONFIG); + imu.getSensorTime(&sensorTime); imu.getTemperature(&imuTemperature); - imu.getAccXYZ(accData); - printf("Sensor Temperature = %5.3f\n", imuTemperature); + printf("ACC xAxis = %s%4.3f\n", "\033[K", accData.xAxis.scaled); printf("ACC yAxis = %s%4.3f\n", "\033[K", accData.yAxis.scaled); printf("ACC zAxis = %s%4.3f\n", "\033[K", accData.zAxis.scaled); + printf("Sensor Time = %s%f\n", "\033[K", sensorTime); + printf("Sensor Temperature = %s%5.3f\n", "\033[K", imuTemperature); printf("\033[H"); //home } }