Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: biquadFilter FastPWM MODSERIAL QEI mbed
Diff: main.cpp
- Revision:
- 47:7919857587f8
- Parent:
- 46:f4dcfe6652ac
- Child:
- 48:1eb0f9ed6cd9
--- a/main.cpp Thu Nov 01 15:30:27 2018 +0000 +++ b/main.cpp Thu Nov 01 16:03:01 2018 +0000 @@ -58,7 +58,7 @@ enum states { calibratingMotors, calibratingEMG, homing, reading, operating, failing, demoing }; -states currentState = calibratingMotors; // start in waiting mode +states currentState = calibratingMotors; // start with calibrating motors bool changeState = true; // initialise the first state Ticker stateTimer; // state machine ticker @@ -654,8 +654,8 @@ // --------------------------- transition ---------------------------- // Transition condition: when all motor errors smaller than 0.01, // start calibrating EMG - if (errorL < 0.01 && errorR < 0.01 - && errorF < 0.01 && buttonHome == false) { + if (errorL < 0.01f && errorR < 0.01f + && errorF < 0.01f && buttonHome == false) { // Actions when leaving state blinkTimer.detach(); @@ -726,8 +726,8 @@ // --------------------------- transition ---------------------------- // Transition condition #1: with button press, enter reading mode, // but only when velocity == 0 - if (errorCalibratedL < 0.01 && errorCalibratedR < 0.01 - && errorCalibratedF < 0.01 && buttonBio1 == true) { + if (errorCalibratedL < 0.01f && errorCalibratedR < 0.01f + && errorCalibratedF < 0.01f && buttonBio1 == false) { // Actions when leaving state /* */ @@ -736,8 +736,8 @@ } // Transition condition #2: with button press, enter demo mode // but only when velocity == 0 - if (errorCalibratedL < 0.01 && errorCalibratedR < 0.01 - && errorCalibratedF < 0.01 && buttonBio2 == true) { + if (errorCalibratedL < 0.01f && errorCalibratedR < 0.01f + && errorCalibratedF < 0.01f && buttonBio2 == false) { // Actions when leaving state /* */ @@ -809,7 +809,7 @@ // --------------------------- transition ---------------------------- // Transition condition: when path is over, back to reading mode - if (errorCalibratedL < 0.01 && errorCalibratedR < 0.01) { + if (errorCalibratedL < 0.01f && errorCalibratedR < 0.01f) { // Actions when leaving state blinkTimer.detach();