Ironcup Mar 2020
Dependencies: mbed mbed-rtos MotionSensor EthernetInterface
Revision 3:e213c44a9f6c, committed 2016-04-11
- Comitter:
- drelliak
- Date:
- Mon Apr 11 21:24:52 2016 +0000
- Parent:
- 2:fd19f7f45e83
- Child:
- 4:8ead8ada8a8b
- Child:
- 5:b0af0cfb678e
- Commit message:
- Added a brake constant
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Apr 11 05:51:34 2016 +0000 +++ b/main.cpp Mon Apr 11 21:24:52 2016 +0000 @@ -1,4 +1,3 @@ -// Teste de alteracao #include "FXAS21002.h" #include "FXOS8700Q.h" #include "mbed.h" @@ -12,6 +11,7 @@ #define INITIAL_I 5.45748932024049 #define INITIAL_D 0.000233453623255507 #define INITIAL_N 51.0605584484153 +#define BRAKE_CONSTANT 30 #define GYRO_OFFSET 0.0152 #define END_THRESH 4 #define START_THRESH 10 @@ -183,9 +183,9 @@ /* Brake function, braking while the gyroscope is still integrating will cause considerably error in the measurement. */ void brakeMotor(){ if(velocity > 0) - setMotorPWM(-30, motor); + setMotorPWM(-BRAKE_CONSTANT, motor); else if(velocity < 0) - setMotorPWM(30, motor); + setMotorPWM(BRAKE_CONSTANT, motor); wait(0.5); setMotorPWM(0,motor); }