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
00001 #include "Kalibratie.h" 00002 #include "Filterdesigns.h" 00003 00004 int samples = 100; // amount of samples taken 00005 double KalibratieMax(AnalogIn& emg, bool side){ //Calibration max value (contracted) 00006 double ymax = 0; 00007 for(int i = 1; i <= samples; i++) { //amount of samples 00008 double u = emg.read(); 00009 double y = 0; 00010 if(side){ // left EMG filter values 00011 y = FilterdesignsLeft(u); 00012 } 00013 else { 00014 y = FilterdesignsRight(u); // right EMG filter values 00015 } 00016 if (y > ymax && i >= samples / 10) { //Check on maximum, not first 10 samples (offset) 00017 ymax = y; 00018 } 00019 wait(0.05); 00020 } 00021 return ymax; 00022 } 00023 00024 double KalibratieMin(AnalogIn& emg, bool side){ //Calibration min value (relaxed) 00025 double ymin = 10; 00026 for(int i = 1; i <= samples; i++) { 00027 double u = emg.read(); 00028 double y = 0; 00029 if(side){ // left EMG values 00030 y = FilterdesignsLeft(u); 00031 } 00032 else { 00033 y = FilterdesignsRight(u); // right EMG values 00034 } 00035 if (y < ymin && i >= samples / 10) { // not first 10 samples (offset) 00036 ymin = y; 00037 } 00038 wait(0.05); 00039 } 00040 return ymin; 00041 }
Generated on Sun Jul 17 2022 19:57:41 by
1.7.2
