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: HIDScope MODSERIAL QEI TextLCD mbed
Fork of TotalControlEmg2 by
Kalibratie.cpp
- Committer:
- RemcoDas
- Date:
- 2015-10-28
- Revision:
- 50:16314b798754
- Parent:
- 44:97f5622db2c4
- Child:
- 51:dcbfdf3b9468
File content as of revision 50:16314b798754:
#include "Kalibratie.h" #include "Filterdesigns.h" int samples = 100; // amount of samples taken double KalibratieMax(AnalogIn& emg, bool side){ //Calibration max value (contracted) double ymax = 0; for(int i = 1; i <= samples; i++) { //amount of samples double u = emg.read(); double y = 0; if(side){ // left EMG filter values y = FilterdesignsLeft(u); } else { y = FilterdesignsRight(u); // right EMG filter values } if (y > ymax && i >= samples / 10) { //Check on maximum, not first 10 samples (offset) ymax = y; } } return ymax; } double KalibratieMin(AnalogIn& emg, bool side){ //Calibration min value (relaxed) double ymin = 10; for(int i = 1; i <= samples; i++) { double u = emg.read(); double y = 0; if(side){ // left EMG values y = FilterdesignsLeft(u); } else { y = FilterdesignsRight(u); // right EMG values } if (y < ymin && i >= samples / 10) { // not first 10 samples (offset) ymin = y; } } return ymin; }