Remco Dasselaar / Mbed 2 deprecated TotalControlEmg2

Dependencies:   HIDScope MODSERIAL QEI TextLCD mbed

Fork of TotalControlEmg2 by Remco Dasselaar

Mode.cpp

Committer:
RemcoDas
Date:
2015-10-28
Revision:
50:16314b798754
Parent:
47:959ef2792024

File content as of revision 50:16314b798754:

#include "Mode.h"
// Determine mode from thresholds
int Mode(int mode, double y, double thresholdlow, double thresholdmid, double thresholdhigh){       
    if ( y <= thresholdlow){        // lowest threshold
        mode = 1;
        }
    else if (y > thresholdhigh){    // above highest threshold
        mode = 3;
        }
    if (y > thresholdmid && mode == 1){ // Not from mode 3 to mode 2
        mode = 2;
        }
    return mode;
}