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 mbed
Diff: calibrate.cpp
- Revision:
- 3:082ba262d2ec
- Parent:
- 2:8b790c03a760
- Child:
- 4:4de31fc4f912
diff -r 8b790c03a760 -r 082ba262d2ec calibrate.cpp --- a/calibrate.cpp Wed Nov 02 16:09:55 2016 +0000 +++ b/calibrate.cpp Thu Nov 03 08:46:55 2016 +0000 @@ -69,6 +69,10 @@ // USED FOR COUNTING HOW MANY SIGNALS HAVE PASSED volatile int count = 0; +// FUNC TO SEND THE DATA TO THE MOTOR +void (*motorFunc)(bool, bool); + + //////////////////////////////////// ///////// HELPER FUNCTIONS ///////// //////////////////////////////////// @@ -141,6 +145,11 @@ float rectifier(float value) { return fabs(value - 0.5f)*2.0f; } + + +void sendToMotor(void (*func)(bool, bool), bool arg1, bool arg2) { + func(arg1, arg2); +} //////////////////////////////////// ///////// HELPER FUNCTIONS ///////// //////////////////////////////////// @@ -258,6 +267,7 @@ } int avgDecide1 = counter1 > std::ceil(numEmgCache/2.0) ? 0: 1; int avgDecide2 = counter2 > std::ceil(numEmgCache/2.0) ? 0: 1; + sendToMotor(motorFunc,avgDecide1, avgDecide2); if(printToHidscope) { scope.set(4,avgDecide1); scope.set(5,avgDecide2); @@ -269,7 +279,9 @@ scope.send(); } - +void consumeBools(bool x, bool y) { + pc.printf("%d\t%d\n\r", x, y); +} int main() { pc.baud(115200); @@ -277,6 +289,8 @@ // initial state resetLeds(); calibrateButton.fall(&calibrate); + // TODO CHANGE THIS TO THE DESIERD FUNCTION (THAT JAN MADE) + motorFunc = &consumeBools; // how to call the calibrating function calibrate();