:)

Dependencies:   HIDScope MODSERIAL mbed-dsp mbed

Fork of emg_filter by BMT M9 Groep01

Files at this revision

API Documentation at this revision

Comitter:
Tanja2211
Date:
Mon Oct 20 10:26:11 2014 +0000
Parent:
53:d90e54fba7d8
Child:
55:f215d954533c
Commit message:
triceps veranderd

Changed in this revision

EMGfilter.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/EMGfilter.cpp	Mon Oct 20 09:11:48 2014 +0000
+++ b/EMGfilter.cpp	Mon Oct 20 10:26:11 2014 +0000
@@ -3,41 +3,7 @@
 #include "MODSERIAL.h"
 #include "arm_math.h"
 
-HIDScope::HIDScope(int channels) : hid(64,64)
-{
-    bufferData      = new float[channels]();
-    channelCount    = channels;
-    scopeData.length = 64;
-}
 
-void HIDScope::set(int ch, float val)
-{
-    bufferData[ch] = val;
-}
-
-void HIDScope::set(int ch, int val)
-{
-    set(ch,(float)val);
-}
-
-void HIDScope::set(int ch, bool val)
-{
-    set(ch,(val ? 1.0f : 0.0f));
-}
-
-void HIDScope::set(int ch, double val)
-{
-    set(ch,(float)val);
-}
-
-void HIDScope::send()
-{
-    for(int ch=0; ch<channelCount; ch++)
-        memcpy(&scopeData.data[ch*4], &bufferData[ch], 4); // Copy a 4 byte float to the char array
-
-    // Send non blocking, can be adjusted to blocking (hid.send)
-    hid.sendNB(&scopeData);
-}
 
 // ****** emg filter shizzle ******
 
@@ -49,7 +15,7 @@
 float filtered_emgT;
 float B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, MOVAVG_B;
 float T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, MOVAVG_T;
-float drempelwaardeB1, drempelwaardeB2, drempelwaardeB3, drempelwaardeT;
+float drempelwaardeB1, drempelwaardeB2, drempelwaardeB3, drempelwaardeT1, drempelwaardeT2;
 
 MODSERIAL pc(USBTX,USBRX);
 
@@ -189,16 +155,38 @@
 
 void AntwoordT()
 {
-    drempelwaardeT=4.99;
-    int y;
-
-    if (MOVAVG_T > drempelwaardeT) {
-        y=1;
-    } else {
-        y=0;
-    }
-
-    if (y==1) {
+    drempelwaardeT1=4.99;
+    drempelwaardeT2=7;
+    int yT1, yT2;
+        
+        if (MOVAVG_T > drempelwaardeT1) {
+            yT1=1;
+            if (MOVAVG_T > drempelwaardeT2) {
+            yT2=1;
+        } else {
+            yT2=0; }
+        } else { 
+            yT1=0;
+        }
+        
+int positie;
+    
+        positie=yT1+yT2;
+        if (positie==0) {
+                pc.printf("Motor 2 beweegt niet\n");
+            } else {
+                pc.printf("Motor 2 gaat beweegen\n"); }
+            if (snelheidsstand==1) {
+                pc.printf("Motor 2 beweegt naar positie 1\n");
+            } else {
+                pc.printf("Motor 1 beweegt niet met snelheid 2\n");
+            }
+            if (snelheidsstand==3) {
+                pc.printf("Motor 1 beweegt met snelheid 3\n");
+            } else {
+                pc.printf("Motor 1 beweegt niet met snelheid 3\n");
+            }
+    if (yT1==1) {
         pc.printf("Motor 2 beweegt\n");
     } else {
         pc.printf("Motor 2 beweegt niet\n");