emg dingetje met moving avarage
Dependencies: HIDScope biquadFilter circular_buffer mbed
Fork of EMG by
Revision 27:674193a62e06, committed 2017-10-24
- Comitter:
- Roytsg
- Date:
- Tue Oct 24 12:58:41 2017 +0000
- Parent:
- 26:97a8adc9b895
- Commit message:
- Project groep 14, use at own risk
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 97a8adc9b895 -r 674193a62e06 main.cpp --- a/main.cpp Tue Oct 24 10:48:48 2017 +0000 +++ b/main.cpp Tue Oct 24 12:58:41 2017 +0000 @@ -15,8 +15,8 @@ /** Sample function * this function samples the emg and sends it to HIDScope **/ - - double A[10]; + int P= 200; + double A[200]; void sample() @@ -47,7 +47,7 @@ scope.set(0, emgFiltered ); scope.set(1, emgabs ); - for(int i = 9; i >= 0; i--){ + for(int i = P-1; i >= 0; i--){ if (i == 0) { A[i] = emgabs; } @@ -56,11 +56,11 @@ } } double sum = 0; - for (int n = 0; n < 9; n++) { + for (int n = 0; n < P-1; n++) { sum = sum + A[n]; } - double movmean = sum/10; + double movmean = sum/P; scope.set(2, movmean); scope.send();