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
Meanvalue.cpp@4:3b9e2d49d5fb, 2015-10-06 (annotated)
- Committer:
- Bartvaart
- Date:
- Tue Oct 06 14:25:53 2015 +0000
- Revision:
- 4:3b9e2d49d5fb
- Child:
- 5:b400209df739
Gemiddelde waarde toegevoegd, zodat er hopelijk minder hoog frequente ruis is.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Bartvaart | 4:3b9e2d49d5fb | 1 | #include "Meanvalue.h" |
| Bartvaart | 4:3b9e2d49d5fb | 2 | |
| Bartvaart | 4:3b9e2d49d5fb | 3 | double sum = 0; |
| Bartvaart | 4:3b9e2d49d5fb | 4 | int a = 0; |
| Bartvaart | 4:3b9e2d49d5fb | 5 | |
| Bartvaart | 4:3b9e2d49d5fb | 6 | double Meanvalue(double y){ |
| Bartvaart | 4:3b9e2d49d5fb | 7 | |
| Bartvaart | 4:3b9e2d49d5fb | 8 | double sum = sum + y; |
| Bartvaart | 4:3b9e2d49d5fb | 9 | int a = a + 1; |
| Bartvaart | 4:3b9e2d49d5fb | 10 | |
| Bartvaart | 4:3b9e2d49d5fb | 11 | if a == 10 |
| Bartvaart | 4:3b9e2d49d5fb | 12 | { |
| Bartvaart | 4:3b9e2d49d5fb | 13 | ymean = sum / a; |
| Bartvaart | 4:3b9e2d49d5fb | 14 | sum = 0; |
| Bartvaart | 4:3b9e2d49d5fb | 15 | a = 0; |
| Bartvaart | 4:3b9e2d49d5fb | 16 | return ymean; |
| Bartvaart | 4:3b9e2d49d5fb | 17 | } |
| Bartvaart | 4:3b9e2d49d5fb | 18 | else{ |
| Bartvaart | 4:3b9e2d49d5fb | 19 | return 0; |
| Bartvaart | 4:3b9e2d49d5fb | 20 | } |
| Bartvaart | 4:3b9e2d49d5fb | 21 | } |
