Example
Dependencies: mbed BMI160 max32630fthr
Diff: main.cpp
- Revision:
- 12:c5e42cadd5d9
- Parent:
- 10:9882df01637d
diff -r 23538d47ba82 -r c5e42cadd5d9 main.cpp --- a/main.cpp Fri Nov 17 21:52:14 2017 +0000 +++ b/main.cpp Wed Dec 29 06:50:39 2021 +0000 @@ -32,7 +32,7 @@ #include "mbed.h" -//#include "max32630fthr.h" +#include "max32630fthr.h" #include "bmi160.h" @@ -45,10 +45,27 @@ { //MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); - DigitalOut rLED(LED1, LED_OFF); - DigitalOut gLED(LED2, LED_OFF); - DigitalOut bLED(LED3, LED_OFF); + DigitalOut rLED(LED1, LED_ON); + DigitalOut gLED(LED2, LED_ON); + DigitalOut bLED(LED3, LED_ON); + //for(int i = 0; i < 10; i++) +// { +// +// rLED = 1; +// wait(1.0); +// rLED = 0; +// wait(1.0); +// +// printf("Blinking time %d \n", i); +// +// } +// +// rLED = 0; +// bLED = 1; +// +// printf("The end"); +// I2C i2cBus(P5_7, P6_0); i2cBus.frequency(400000); BMI160_I2C imu(i2cBus, BMI160_I2C::I2C_ADRS_SDO_LO); @@ -74,7 +91,7 @@ BMI160::AccConfig accConfig; - //example of using getSensorConfig +// example of using getSensorConfig if(imu.getSensorConfig(accConfig) == BMI160::RTN_NO_ERROR) { printf("ACC Range = %d\n", accConfig.range); @@ -88,7 +105,7 @@ failures++; } - //example of setting user defined configuration +// example of setting user defined configuration accConfig.range = BMI160::SENS_4G; accConfig.us = BMI160::ACC_US_OFF; accConfig.bwp = BMI160::ACC_BWP_2; @@ -125,7 +142,7 @@ if(failures == 0) { - float imuTemperature; +// flo//at imuTemperature; BMI160::SensorData accData; BMI160::SensorData gyroData; BMI160::SensorTime sensorTime;