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
Mode.cpp@57:eea0d7265b22, 2015-10-29 (annotated)
- Committer:
- RemcoDas
- Date:
- Thu Oct 29 16:30:51 2015 +0000
- Revision:
- 57:eea0d7265b22
- Parent:
- 50:16314b798754
Final
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Bartvaart | 18:eec0880fcded | 1 | #include "Mode.h" |
| RemcoDas | 50:16314b798754 | 2 | // Determine mode from thresholds |
| RemcoDas | 47:959ef2792024 | 3 | int Mode(int mode, double y, double thresholdlow, double thresholdmid, double thresholdhigh){ |
| RemcoDas | 50:16314b798754 | 4 | if ( y <= thresholdlow){ // lowest threshold |
| Bartvaart | 18:eec0880fcded | 5 | mode = 1; |
| Bartvaart | 18:eec0880fcded | 6 | } |
| RemcoDas | 50:16314b798754 | 7 | else if (y > thresholdhigh){ // above highest threshold |
| Bartvaart | 19:6c0245063b96 | 8 | mode = 3; |
| Bartvaart | 19:6c0245063b96 | 9 | } |
| RemcoDas | 50:16314b798754 | 10 | if (y > thresholdmid && mode == 1){ // Not from mode 3 to mode 2 |
| Bartvaart | 18:eec0880fcded | 11 | mode = 2; |
| Bartvaart | 18:eec0880fcded | 12 | } |
| Bartvaart | 18:eec0880fcded | 13 | return mode; |
| Bartvaart | 18:eec0880fcded | 14 | } |
