BopIt on the mbed

Dependencies:   SDFileSystem mbed wave_player

Revision:
0:d30842e497f7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/chSig.cpp	Thu Oct 17 19:58:54 2013 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h" 
+//slider 
+AnalogIn slid(p15); 
+//dial 
+AnalogIn twis(p16); 
+//Motion
+AnalogIn swip(p19);
+//boop 
+DigitalIn boo(p21); 
+
+Serial px(USBTX, USBRX); 
+
+int chSig( int value, float sl, float tw) {
+     int check; 
+    if(value == 0 && boo.read()!=0){ 
+        check = 1; 
+     }else if (value ==1 && ( slid.read() >= (sl + 0.05) || slid.read() <= (sl-0.05) ) ){ 
+        check = 1; 
+     }else if(value==2 && swip.read() > 0.5){ 
+        check = 1; 
+     }else if(value ==3 && ( (tw-.05)>= twis.read() ||  twis.read()>=(tw+.05) ) ){
+        check = 1; 
+     }else if( (value!=0 && boo.read() != 0)){ 
+        check=2; 
+     } else if( value!=1 && ( slid.read() >= (sl + 0.05) || slid.read() <= (sl-0.05) ) ) {
+         check = 2; 
+     }else if( value !=3 && ( (tw-.05)>= twis.read() ||  twis.read()>=(tw+.05) ) ) { 
+         check = 2; 
+     }else if( value!=2 && swip.read()>0.5 ) { 
+         check = 2; 
+     }else{ 
+        check = 0; 
+     }
+     return check; 
+  
+  }
+     
\ No newline at end of file