Eduardo Vergara
/
BNO080_program
added main and defined M_PI
Diff: main.cpp
- Revision:
- 7:b548a684290d
- Parent:
- 5:eefbf579d5cc
- Child:
- 8:729ad465d6c9
--- a/main.cpp Tue Jul 30 16:44:23 2019 +0000 +++ b/main.cpp Tue Jul 30 21:06:04 2019 +0000 @@ -1,21 +1,22 @@ #include <mbed.h> #include <BNO080.h> +#include "Watchdog.h" int main() { - Serial pc(USBTX, USBRX, 192000); - + Serial pc(USBTX, USBRX, 57600); + Watchdog dog; + dog.Configure(1.7); //need to find the time for entire program to run // Create IMU, passing in output stream, pins, I2C address, and I2C frequency - // These pin assignments are specific to my dev setup -- you'll need to change them - BNO080 imu(&pc, D4, D5, D12, D10, 0x4b, 100000); - + // These pin assignments are specific to stm32- L432KC + //BNO080 imu(&pc, D4, D5, D12, D10, 0x4b, 100000); + BNO080 imu(&pc, D2, D4, D13, PB_6, 0x4b, 100000); imu.begin(); // Tell the IMU to report rotation every 100ms and acceleration every 200ms - + imu.enableReport(BNO080::TOTAL_ACCELERATION, 100); - //imu.enableReport(BNO080::GRAVITY_ACCELERATION, 100); imu.enableReport(BNO080::ROTATION, 100); while (true) { @@ -28,14 +29,16 @@ if (imu.hasNewData(BNO080::TOTAL_ACCELERATION) || imu.hasNewData(BNO080::ROTATION)) { pc.printf("Total Accel: "); imu.totalAcceleration.print(pc, true); - + pc.printf(", Rotation:"); TVector3 eulerRadians = imu.rotationVector.euler(); TVector3 eulerDegrees = eulerRadians * (180.0 / M_PI); eulerDegrees.print(pc, true); pc.printf("\n"); + + dog.Service(); } - + } }