Template for ES456 MadPulse Control Lab
Dependencies: BNO055_fusion ServoIn ServoOut mbed
Fork of ES456_Final_Proj_Faculty by
Revision 6:d133964667f3, committed 2016-11-28
- Comitter:
- piper
- Date:
- Mon Nov 28 13:08:24 2016 +0000
- Parent:
- 5:03074e90ef7a
- Commit message:
- Set hall effect sensor interrupt to pin 11
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 03074e90ef7a -r d133964667f3 main.cpp --- a/main.cpp Sun Nov 20 19:29:37 2016 +0000 +++ b/main.cpp Mon Nov 28 13:08:24 2016 +0000 @@ -30,7 +30,7 @@ ServoIn CH1(p15); ServoIn CH2(p16); -InterruptIn he_sensor(p23); +InterruptIn he_sensor(p11); ServoOut Steer(p22); ServoOut Throttle(p21); Timer t; // create timer instance @@ -47,7 +47,7 @@ // USER DEFINED VARIABLES float distance; float steering_offset; -float hdg_comp, hdg_gyro; +float hdg_comp, hdg_gyro, hdg_est; // ============================================ @@ -148,7 +148,7 @@ // ******************************************* // Compute speed from hall effect sensor if(t.read()-t_hall < 0.2) { - speed = WHL_RADIUS*GEAR_RATIO*(2*PI)/(dt_hall); // inches/sec + speed = 2*WHL_RADIUS*GEAR_RATIO*(2*PI)/(dt_hall); // inches/sec } else { speed = 0; }