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-22
- Revision:
- 41:91c8c39d7a33
- Parent:
- 30:8ae855348d22
- Child:
- 44:97f5622db2c4
File content as of revision 41:91c8c39d7a33:
#include "Kalibratie.h" #include "Filterdesigns.h" /* DigitalOut LedGreen(LED2); DigitalOut LedRed(LED1); */ int samples = 100; // amount of samples taken /* void Init(){ LedGreen = 1; LedRed = 1; }*/ double KalibratieMax(AnalogIn& emg, bool side){ //Kalibratie van de maximum waarde //LedGreen.write(0); //Led aan double ymax = 0; for(int i = 1; i <= samples; i++) { //amount of samples double u = emg.read(); double y = 0; if(side){ // links y = FilterdesignsLeft(u); } else { y = FilterdesignsRight(u); // rechts } if (y > ymax && i >= samples / 10) { //Als de gemeten waarde groter is dan de opgeslagen waarde wordt dit de nieuwe opgeslagen waarde ymax = y; } wait(0.05); } LedGreen.write(1); //Led aan return ymax; } double KalibratieMin(AnalogIn& emg, bool side){ //Kalibratie van de minimum waarde //LedRed.write(0); double ymin = 10; for(int i = 1; i <= samples; i++) { double u = emg.read(); double y = 0; if(side){ // links y = FilterdesignsLeft(u); } else { y = FilterdesignsRight(u); // rechts } if (y < ymin && i >= samples / 10) { ymin = y; } wait(0.05); } //LedRed.write(1); return ymin; }