calibrate
Dependencies: FastPWM MODSERIAL QEI mbed
Revision 0:46c28ea3feb9, committed 2018-10-30
- Comitter:
- s1737619
- Date:
- Tue Oct 30 15:00:46 2018 +0000
- Commit message:
- calibratie
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FastPWM.lib Tue Oct 30 15:00:46 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/Sissors/code/FastPWM/#c0b2265cff9c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Tue Oct 30 15:00:46 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/Sissors/code/MODSERIAL/#da0788f0bd77
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QEI.lib Tue Oct 30 15:00:46 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/aberk/code/QEI/#5c2ad81551aa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 30 15:00:46 2018 +0000 @@ -0,0 +1,72 @@ +#include "mbed.h" + +//global variables + +double EMG_filt1; +double EMG_filt2; +double EMG_filt3; +double EMG_filt4; +bool calibrationbool; +double EMG_max1 = 10000.0; +double EMG_max2 = 10000.0; +double EMG_max3 = 10000.0; +double EMG_max4 = 10000.0; + +void calibrationbutton +{ + calibrationbool = true; + EMG_max1 = 0.0001; + EMG_max2 = 0.0001; + EMG_max3 = 0.0001; + EMG_max4 = 0.0001; + +} + +void switchtostate +{ + calibrationbool = false //Dit moet waarschijnlijk anders in het hele script. +} + +void calibratie() +{ + static int count + + if (0.95*EMG_filt1>EMG_max1) + { + EMG_max1 = 0.95*EMG_filt1; + } + if (0.95*EMG_filt2>EMG_max2) + + { + EMG_max2 = 0.95*EMG_filt2; + } + + if (0.95*EMG_filt3>EMG_max3) + { + EMG_max3 = 0.95*EMG_filt3; + } + if (0.95*EMG_filt4>EMG_max4) + { + EMG_max4 = 0.95*EMG_filt4; + } + + count++; + if (count == eengetal) + { + switchtostate() + } + } +} + + InterruptIn button + + +int main +{ + button.fall(calibrationbutton) + + while (true) + { + } + + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 30 15:00:46 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file