Remco Dasselaar / Mbed 2 deprecated TotalControlEmg2

Dependencies:   HIDScope MODSERIAL QEI TextLCD mbed

Fork of TotalControlEmg2 by Remco Dasselaar

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Mode.cpp Source File

Mode.cpp

00001 #include "Mode.h"
00002 // Determine mode from thresholds
00003 int Mode(int mode, double y, double thresholdlow, double thresholdmid, double thresholdhigh){       
00004     if ( y <= thresholdlow){        // lowest threshold
00005         mode = 1;
00006         }
00007     else if (y > thresholdhigh){    // above highest threshold
00008         mode = 3;
00009         }
00010     if (y > thresholdmid && mode == 1){ // Not from mode 3 to mode 2
00011         mode = 2;
00012         }
00013     return mode;
00014 }