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
Diff: Kalibratie.cpp
- Revision:
- 25:c97d079e07f3
- Parent:
- 24:ddd69385b55f
- Child:
- 26:d9855716ced7
--- a/Kalibratie.cpp Thu Oct 15 11:13:32 2015 +0000 +++ b/Kalibratie.cpp Fri Oct 16 08:04:48 2015 +0000 @@ -2,46 +2,36 @@ #include "Filterdesigns.h" //#include "MODSERIAL.h" //bugfix -AnalogIn emg2(A0); //Analog input van emg kabels +//AnalogIn emg2(A0); //Analog input van emg kabels //MODSERIAL pc2(USBTX, USBRX); //bugfix DigitalOut LedGreen(LED2); DigitalOut LedRed(LED1); int samples = 100; -void Init() -{ +void Init(){ LedGreen = 1; LedRed = 1; } -double KalibratieMax(bool &readymax) //Kalibratie van de maximum waarde -{ - //pc2.baud(115200); +double KalibratieMax(AnalogIn& emg){ //Kalibratie van de maximum waarde LedGreen.write(0); //Led aan double ymax = 0; - + for(int i = 1; i <= samples; i++) { //Als timer onder de 5 seconden is dit uitvoeren - double u = emg2.read(); - double y = Filterdesigns(u); - + double u = emg.read(); + double y = Filterdesigns(u); if (y > ymax && i >= samples / 10) { //Als de gemeten waarde groter is dan de opgeslagen waarde wordt dit de nieuwe opgeslagen waarde ymax = y; - } - else {} - //pc2.printf("y = %f en ymax = %f \n",y,ymax); //bugfix + } wait(0.05); - } - - LedGreen.write(1); //Led aan - readymax = 1; // Zodat systeem weet wanneer kalibratie voltooid is + } + LedGreen.write(1); //Led aan return ymax; } -double KalibratieMin(bool &readymin) //Kalibratie van de minimum waarde -{ - //pc2.baud(115200); +double KalibratieMin(AnalogIn& emg){ //Kalibratie van de minimum waarde LedRed.write(0); double ymin = 10; @@ -51,13 +41,9 @@ if (y < ymin && i >= samples / 10) { ymin = y; - } - else {} - //pc2.printf("y = %f en ymin = %f \n",y,ymin); //bugfix + } wait(0.05); - } - + } LedRed.write(1); - readymin = 1; return ymin; } \ No newline at end of file