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: Meanvalue.cpp
- Revision:
- 5:b400209df739
- Parent:
- 4:3b9e2d49d5fb
- Child:
- 9:1655d67d8a53
diff -r 3b9e2d49d5fb -r b400209df739 Meanvalue.cpp
--- a/Meanvalue.cpp Tue Oct 06 14:25:53 2015 +0000
+++ b/Meanvalue.cpp Wed Oct 07 11:10:36 2015 +0000
@@ -1,21 +1,19 @@
#include "Meanvalue.h"
-double sum = 0;
-int a = 0;
-double Meanvalue(double y){
+double Meanvalue(double y, double &sum, int &a, double &ymean, int delay){
- double sum = sum + y;
- int a = a + 1;
+ sum = sum + y;
+ a = a + 1;
- if a == 10
+ if (a == delay)
{
- ymean = sum / a;
+ double ymean = sum / a;
sum = 0;
a = 0;
return ymean;
}
else{
- return 0;
+ return ymean;
}
}
\ No newline at end of file
