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
Diff: main.cpp
- Revision:
- 7:1be7e6735fe2
- Parent:
- 6:f2c930a90873
- Child:
- 8:1011786787a4
diff -r f2c930a90873 -r 1be7e6735fe2 main.cpp --- a/main.cpp Sun Apr 09 16:28:10 2017 +0000 +++ b/main.cpp Sun Apr 09 18:37:31 2017 +0000 @@ -14,14 +14,17 @@ InterruptIn button(USER_BUTTON); PwmOut P1(PE_9); -PwmOut P2(PE_11); -PwmOut P3(PE_13); +//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; @@ -32,17 +35,22 @@ P1 = (euler_angles.h/360.0); - P2 = (euler_angles.r/360.0); - P3 = (euler_angles.p/360.0); + //P2 = (euler_angles.r/360.0); + //P3 = (euler_angles.p/360.0); } void eventFunction() { + if(!isPressed) { - pwmint.attach(&pwmupdate, .005); + pwmint.attach(&pwmupdate, .5); isPressed=1; + } else { pwmint.detach(); + P1 = 0; + //P2 = 0; + //P3 = 0; isPressed=0; } } @@ -57,13 +65,13 @@ 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); + //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); @@ -73,6 +81,7 @@ 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);