Volledig besturingssysteem voor de myoelectrische prothese arm van mijn bachelor opdracht

Dependencies:   mbed QEI MODSERIAL FastPWM biquadFilter

Revision:
10:193942c3900a
Parent:
9:ad4bd1b16eed
Child:
11:08ba9cfc9c8f
diff -r ad4bd1b16eed -r 193942c3900a main.cpp
--- a/main.cpp	Fri Apr 19 09:30:32 2019 +0000
+++ b/main.cpp	Fri Apr 19 09:40:17 2019 +0000
@@ -620,7 +620,7 @@
                 timer_calibration.start();
                 while(timer_calibration<20) {                           //Duim
                     if(timer_calibration>0 && timer_calibration<20) {
-                        led1=!led1;
+
                         if(emg1_filtered>temp_highest_emg1) {
                             temp_highest_emg1= emg1_filtered;
                             pc.printf("Highest value Duim= %f \r\n", temp_highest_emg1);
@@ -642,9 +642,6 @@
                         }
 
                     }
-                    led1=1;
-                    led2=1;
-                    led3=1;
 
                 }
                 pc.printf("threshold calculation\r\n");
@@ -814,6 +811,7 @@
                     Input1 = pwm1;
                     Input2 = pwm2;
                     Pwm.attach (PwmMotor, Ts);
+                    sample_ticker.attach(&emgsample, 0.001);            // Leest het ruwe EMG signaal af met een frequentie van 1000Hz
                     
                     servo_position1 = Duim_krom;
                     servo_position2 = MWP_krom;
@@ -863,6 +861,7 @@
             } else if (!button3) {
                 Pwm.detach ();
                 ServoTick.detach();
+                sample_ticker.detach();
                 pwmpin2 = 0;
                 pwmpin1 = 0;
                 counts = 0;
@@ -873,6 +872,7 @@
                 t.reset();
                 Pwm.detach ();
                 ServoTick.detach();
+                sample_ticker.detach();
                 counts = 0;
                 currentState = HOMING1  ;
                 stateChanged = true;
@@ -913,6 +913,12 @@
     //PotRead.attach(ContinuousReader,Ts);
     pc.baud(115200);
 
+//BiQuad Chain add
+    highp1.add( &highp1_1 ).add( &highp1_2 ).add( &notch1_1 );
+    highp2.add( &highp2_1 ).add( &highp2_2 ).add( &notch2_1 );
+    highp3.add( &highp3_1 ).add( &highp3_2 ).add( &notch3_1 );
+    highp4.add( &highp4_1 ).add( &highp4_2 ).add( &notch4_1 );
+
     while(true) {
         led1 = 1;
         led2 =1;