FOrk
Dependencies: Servo AX12_final MX106_not_working comunication_1
Diff: MX.cpp
- Revision:
- 12:6ac3cac5677c
- Parent:
- 11:19e8022f60ea
- Child:
- 22:ffb26af4d5d8
diff -r 19e8022f60ea -r 6ac3cac5677c MX.cpp --- a/MX.cpp Wed Jul 13 15:53:34 2016 +0000 +++ b/MX.cpp Thu Nov 24 15:29:50 2016 +0000 @@ -1,6 +1,6 @@ #include "MX.h" -#include <cmath> +#include <math.h> #define MOVING_SPEED_UNIT_RPM 0.114 @@ -251,6 +251,10 @@ this->maxSpeedDegreeS = maxSpeedDegreeS; } +int min(int a, int b) { + if(a < b) return a; else return b; +} + void MX::setCRSpeed(float goalSpeedDegreeS) { // bit 10 = direction, 0 = CCW, 1=CW // bits 9-0 = Speed @@ -258,7 +262,7 @@ float rpm = std::abs(goalSpeedDegreeS * _gear_train) / 360 * 60; int goal = rpm / MOVING_SPEED_UNIT_RPM; - goal = fmin(goal, 0x3ff); + goal = min(goal, 0x3ff); // Set direction CW if we have a negative speed if (goalSpeedDegreeS < 0) {