This is the one where I went back and un-did the cube.cpp file
Dependencies: BNO055_fusion_tom FastPWM mbed
Fork of NucleoCube1 by
main.cpp
- Committer:
- wchurch
- Date:
- 2017-04-09
- Revision:
- 7:1be7e6735fe2
- Parent:
- 6:f2c930a90873
- Child:
- 8:1011786787a4
File content as of revision 7:1be7e6735fe2:
#include "mbed.h" #include "BNO055.h" //------------------------------------ // Hyperterminal configuration // 9600 bauds, 8-bit data, no parity //------------------------------------ Serial pc(SERIAL_TX, SERIAL_RX); Ticker pwmint; DigitalOut myled(LED1); InterruptIn button(USER_BUTTON); PwmOut P1(PE_9); //PwmOut P2(PE_11); 1D FOCUS FOR NOW //PwmOut P3(PE_13); I2C i2c(PB_9, PB_8); // SDA, SCL BNO055 imu(i2c, PA_8); // Reset BNO055_ID_INF_TypeDef bno055_id_inf; BNO055_EULER_TypeDef euler_angles; //BNO055_EULER_TypeDef velocity; IN PROGESS int i = 180; int isPressed; void pwmupdate() { myled = !myled; P1 = (euler_angles.h/360.0); //P2 = (euler_angles.r/360.0); //P3 = (euler_angles.p/360.0); } void eventFunction() { if(!isPressed) { pwmint.attach(&pwmupdate, .5); isPressed=1; } else { pwmint.detach(); P1 = 0; //P2 = 0; //P3 = 0; isPressed=0; } } int main() { pc.printf("Bosch Sensortec BNO055 test program on " __DATE__ "/" __TIME__ "\r\n"); if (imu.chip_ready() == 0){ pc.printf("Bosch BNO055 is NOT available!!\r\n"); } imu.read_id_inf(&bno055_id_inf); //pc.printf("CHIP:0x%02x, ACC:0x%02x, MAG:0x%02x, GYR:0x%02x, , SW:0x%04x, , BL:0x%02x\r\n", // bno055_id_inf.chip_id, bno055_id_inf.acc_id, bno055_id_inf.mag_id, // bno055_id_inf.gyr_id, bno055_id_inf.sw_rev_id, bno055_id_inf.bootldr_rev_id); P1.period(0.0002); isPressed=0; button.rise(&eventFunction); while(1) { pc.printf("Heading:%+6.4f [deg], Roll:%+6.4f [deg], Pitch:%+6.4f [deg]\r\n", euler_angles.h, euler_angles.r, euler_angles.p); imu.get_Euler_Angles(&euler_angles); wait(0.2); } }