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.
Fork of EMG_MetFilter_HP_05HZ by
Revision 1:000418a0aedf, committed 2013-10-31
- Comitter:
- DanAuhust
- Date:
- Thu Oct 31 12:15:47 2013 +0000
- Parent:
- 0:8aa426d4db1f
- Child:
- 2:b0b86581ba50
- Commit message:
- alle ins en outs gedefinieerd
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Oct 31 12:00:23 2013 +0000
+++ b/main.cpp Thu Oct 31 12:15:47 2013 +0000
@@ -75,6 +75,58 @@
**/
float filter(float value, int sig_number){
+ // eerst variabelen definieren
+ float emg_value; //output filters
+ //biceps
+ float in0_biceps =0;
+ static float in1_biceps =0, in2_biceps = 0, in3_biceps = 0, in4_biceps = 0;
+ static float out0_biceps = 0, out1_biceps = 0 , out2_biceps = 0, out3_biceps = 0, out4_biceps = 0;
+
+ float in0_2_biceps =0;
+ static float in1_2_biceps =0, in2_2_biceps = 0, in3_2_biceps = 0, in4_2_biceps = 0;
+ static float out0_2_biceps = 0, out1_2_biceps = 0 , out2_2_biceps = 0, out3_2_biceps = 0, out4_2_biceps = 0;
+
+ float in0_3_biceps =0;
+ static float in1_3_biceps =0, in2_3_biceps = 0, in3_3_biceps = 0, in4_3_biceps = 0;
+ static float out0_3_biceps = 0, out1_3_biceps = 0 , out2_3_biceps = 0, out3_3_biceps = 0, out4_3_biceps = 0;
+ //triceps
+ float in0_triceps =0;
+ static float in1_triceps =0, in2_triceps = 0, in3_triceps = 0, in4_triceps = 0;
+ static float out0_triceps = 0, out1_triceps = 0 , out2_triceps = 0, out3_triceps = 0, out4_triceps = 0;
+
+ float in0_2_triceps =0;
+ static float in1_2_triceps =0, in2_2_triceps = 0, in3_2_triceps = 0, in4_2_triceps = 0;
+ static float out0_2_triceps = 0, out1_2_triceps = 0 , out2_2_triceps = 0, out3_2_triceps = 0, out4_2_triceps = 0;
+
+ float in0_3_triceps =0;
+ static float in1_3_triceps =0, in2_3_triceps = 0, in3_3_triceps = 0, in4_3_triceps = 0;
+ static float out0_3_triceps = 0, out1_3_triceps = 0 , out2_3_triceps = 0, out3_3_triceps = 0, out4_3_triceps = 0;
+ //flexoren
+ float in0_flexoren =0;
+ static float in1_flexoren =0, in2_flexoren = 0, in3_flexoren = 0, in4_flexoren = 0;
+ static float out0_flexoren = 0, out1_flexoren = 0 , out2_flexoren = 0, out3_flexoren = 0, out4_flexoren = 0;
+
+ float in0_2_flexoren =0;
+ static float in1_2_flexoren =0, in2_2_flexoren = 0, in3_2_flexoren = 0, in4_2_flexoren = 0;
+ static float out0_2_flexoren = 0, out1_2_flexoren = 0 , out2_2_flexoren = 0, out3_2_flexoren = 0, out4_2_flexoren = 0;
+
+ float in0_3_flexoren =0;
+ static float in1_3_flexoren =0, in2_3_flexoren = 0, in3_3_flexoren = 0, in4_3_flexoren = 0;
+ static float out0_3_flexoren = 0, out1_3_flexoren = 0 , out2_3_flexoren = 0, out3_3_flexoren = 0, out4_3_flexoren = 0;
+ //extensoren
+ float in0_extensoren =0;
+ static float in1_extensoren =0, in2_extensoren = 0, in3_extensoren = 0, in4_extensoren = 0;
+ static float out0_extensoren = 0, out1_extensoren = 0 , out2_extensoren = 0, out3_extensoren = 0, out4_extensoren = 0;
+
+ float in0_2_extensoren =0;
+ static float in1_2_extensoren =0, in2_2_extensoren = 0, in3_2_extensoren = 0, in4_2_extensoren = 0;
+ static float out0_2_extensoren = 0, out1_2_extensoren = 0 , out2_2_extensoren = 0, out3_2_extensoren = 0, out4_2_extensoren = 0;
+
+ float in0_3_extensoren =0;
+ static float in1_3_extensoren =0, in2_3_extensoren = 0, in3_3_extensoren = 0, in4_3_extensoren = 0;
+ static float out0_3_extensoren = 0, out1_3_extensoren = 0 , out2_3_extensoren = 0, out3_3_extensoren = 0, out4_3_extensoren = 0;
+
+
switch(sig_number){
case 1:
break;
@@ -90,7 +142,7 @@
void looper()
{
- float emg_value;
+
/*put raw emg value both in red and in emg_value*/
/*send value to PC. use 6 digits after decimal sign*/
@@ -107,7 +159,6 @@
out4_2_biceps = out3_2_biceps; out3_2_biceps = out2_2_biceps; out2_2_biceps = out1_2_biceps; out1_2_biceps = out0_2_biceps;
out0_2_biceps = (NUM0_2*in0_2_biceps + NUM1_2*in1_2_biceps + NUM2_2*in2_2_biceps + NUM3_2*in3_2_biceps + NUM4_2*in4_2_biceps - DEN1_2*out1_2_biceps - DEN2_2*out2_2_biceps - DEN3_2*out3_2_biceps - DEN4_2*out4_2_biceps ) / DEN0_2;
-
//signaal filteren op 5Hz LOWPASS
in4_3_biceps = in3_3_biceps; in3_3_biceps = in2_3_biceps; in2_3_biceps = in1_3_biceps; in1_3_biceps = in0_3_biceps;
in0_3_biceps = abs(out0_2_biceps);
