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
Kalibratie.cpp
00001 #include "Kalibratie.h" 00002 #include "Filterdesigns.h" 00003 //#include "MODSERIAL.h" //bugfix 00004 00005 //AnalogIn emg2(A0); //Analog input van emg kabels 00006 //MODSERIAL pc2(USBTX, USBRX); //bugfix 00007 DigitalOut LedGreen(LED2); 00008 DigitalOut LedRed(LED1); 00009 00010 int samples = 100; 00011 00012 void Init(){ 00013 LedGreen = 1; 00014 LedRed = 1; 00015 } 00016 00017 double KalibratieMax(AnalogIn& emg, bool side){ //Kalibratie van de maximum waarde 00018 LedGreen.write(0); //Led aan 00019 double ymax = 0; 00020 00021 for(int i = 1; i <= samples; i++) { //Als timer onder de 5 seconden is dit uitvoeren 00022 double u = emg.read(); 00023 double y = 0; 00024 if(side){ // links 00025 y = FilterdesignsLeft(u); 00026 } 00027 else { 00028 y = FilterdesignsRight(u); // rechts 00029 } 00030 if (y > ymax && i >= samples / 10) { //Als de gemeten waarde groter is dan de opgeslagen waarde wordt dit de nieuwe opgeslagen waarde 00031 ymax = y; 00032 } 00033 wait(0.05); 00034 } 00035 LedGreen.write(1); //Led aan 00036 return ymax; 00037 } 00038 00039 double KalibratieMin(AnalogIn& emg, bool side){ //Kalibratie van de minimum waarde 00040 LedRed.write(0); 00041 double ymin = 10; 00042 00043 for(int i = 1; i <= samples; i++) { 00044 double u = emg.read(); 00045 double y = 0; 00046 if(side){ // links 00047 y = FilterdesignsLeft(u); 00048 } 00049 else { 00050 y = FilterdesignsRight(u); // rechts 00051 } 00052 00053 if (y < ymin && i >= samples / 10) { 00054 ymin = y; 00055 } 00056 wait(0.05); 00057 } 00058 LedRed.write(1); 00059 return ymin; 00060 }
Generated on Fri Aug 5 2022 02:26:40 by
1.7.2