Alle subfiles samengevoegd
Dependencies: HIDScope biquadFilter mbed MODSERIAL FastPWM QEI
Diff: main.cpp
- Revision:
- 5:b4a0301ec8cc
- Parent:
- 4:05c5da1c8b08
- Child:
- 6:00011220b82b
--- a/main.cpp Mon Oct 24 10:15:56 2016 +0000 +++ b/main.cpp Tue Oct 25 07:03:16 2016 +0000 @@ -11,7 +11,7 @@ AnalogIn emg1( A1 ); //Bicpes Links AnalogIn emg2( A2 ); //Upper leg //HIDScope -HIDScope scope( 6 ); // aantal channels op de HIDscope +//HIDScope scope( 6 ); // aantal channels op de HIDscope //Button om Calibratie te beëindigen InterruptIn Button1(PTC6); // DIT WORDT EEN ANDERE BUTTON @@ -89,13 +89,13 @@ /* EMG signal in channel 0 (the first channel) and the filtered EMG signal in channel 1 (the second channel) of the HIDscope */ - scope.set(0,inRechts); + /*scope.set(0,inRechts); scope.set(1,outRechts); scope.set(2,inLinks); scope.set(3,outLinks); scope.set(4,inBeen); scope.set(5,outBeen); - + */ // To indicate that the function is working, the LED is on if (outRechts >= 0.04){ BicepsRight = true; @@ -184,7 +184,7 @@ else if (y < 50) { y = 50; // GOKJE, UITPROBEREN } - pc.printf("x = %f, y = %f\r\n", x, y); + //pc.printf("x = %f, y = %f\r\n", x, y); //scope.set(2,x); //scope.set(3,y); @@ -232,7 +232,7 @@ // omrekenen van grote tandwiel naar motortandwiel Theta1 = Theta1Gear*42.0/12.0; // grote tandwiel heeft 42 tanden. Motortandwiel heeft er 12. - pc.printf("thetaMotor = %f, thetaGear = %f, Prev_Gear = %f\r\n", Theta1, Theta1Gear); + pc.printf("thetaMotor = %f, thetaGear = %f\r\n", Theta1, Theta1Gear); } void CalcTheta2 (double Dia2) { @@ -255,7 +255,7 @@ // omrekenen van grote tandwiel naar motortandwiel Theta2 = Theta2Gear*42.0/12.0; // grote tandwiel heeft 42 tanden. Motortandwiel heeft er 12. - pc.printf("thetaMotor = %f, thetaGear = %f, Prev_Gear = %f\r\n", Theta2, Theta2Gear); + pc.printf("thetaMotor = %f, thetaGear = %f\r\n", Theta2, Theta2Gear); } // als een van de hoeken te groot wordt, zet dan alles terug naar de vorige positie @@ -271,6 +271,7 @@ Theta1 = Theta1Gear*42.0/12.0; Theta2 = Theta2Gear*42.0/12.0; } + pc.printf("thetaMotor = %f, thetaGear = %f\r\n", Theta2, Theta2Gear); } void CalculationsForTheta () { @@ -286,7 +287,7 @@ CalcTheta2 (Dia2); AngleLimits (Theta1Gear, Theta2Gear, Prev_x, Prev_y); - scope.send(); + //scope.send(); } // als de button ingedrukt wordt dan stoppen we met calibreren @@ -325,7 +326,7 @@ // sample_timer.attach(&sample, 0.002); // ticker voor hoek berekenen aanzetten - TickerCalculationsForTheta.attach(&CalculationsForTheta,0.002); + TickerCalculationsForTheta.attach(&CalculationsForTheta,1); //0.002 //empty loop, sample() is executed periodically while(1) {