Alle subfiles samengevoegd
Dependencies: HIDScope biquadFilter mbed MODSERIAL FastPWM QEI
Diff: main.cpp
- Revision:
- 18:32e9db0d47c9
- Parent:
- 17:ea90b7340cbb
- Child:
- 19:3af738c38db0
--- a/main.cpp Tue Nov 01 14:28:05 2016 +0000 +++ b/main.cpp Wed Nov 02 10:35:47 2016 +0000 @@ -103,7 +103,7 @@ volatile double x = 0.0; // beginpositie x en y volatile double y = 305.5; volatile const double pi = 3.14159265359; -volatile double Speed = 10; // Speed with which x and y are changed, in mm/s +volatile double Speed = 30; // Speed with which x and y are changed, in mm/s volatile double Theta1Gear = 60.0; // Beginpositie op 60 graden volatile double Theta2Gear = 60.0; volatile const int LargeGear = 42; @@ -269,22 +269,22 @@ } // If Biceps links is actuated then: - if (outLinks >= 0.03){ + if (outLinks >= 0.02){ BicepsLeft = true; - blue = 0; + green = 0; } else{ BicepsLeft = false; - blue = 1; + green = 1; } // If upper leg is actuated then: if (outBeen >= 0.02){ Leg = true; - green = 0; + blue = 0; } else{ Leg = false; - green = 1; + blue = 1; } } @@ -397,7 +397,7 @@ // omrekenen van grote tandwiel naar motortandwiel Theta1 = Theta1Gear*LargeGear/SmallGear; // grote tandwiel heeft 42 tanden. Motortandwiel heeft er 12. - pc.printf("thetaMotor = %f, thetaGear = %f\r\n", Theta1, Theta1Gear); + //pc.printf("thetaMotor = %f, thetaGear = %f\r\n", Theta1, Theta1Gear); } void CalcTheta2 (double Dia2) { @@ -420,7 +420,7 @@ // omrekenen van grote tandwiel naar motortandwiel Theta2 = Theta2Gear*LargeGear/SmallGear; // grote tandwiel heeft 42 tanden. Motortandwiel heeft er 12. - pc.printf("thetaMotor = %f, thetaGear = %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 @@ -436,7 +436,7 @@ Theta1 = Theta1Gear*LargeGear/SmallGear; Theta2 = Theta2Gear*LargeGear/SmallGear; } - pc.printf("thetaMotor = %f, thetaGear = %f\r\n", Theta2, Theta2Gear); + //pc.printf("thetaMotor = %f, thetaGear = %f\r\n", Theta2, Theta2Gear); } void CalculationsForTheta () { @@ -450,7 +450,7 @@ double Dia2 = CalcDia2 (x, y); CalcTheta1 (Dia1); CalcTheta2 (Dia2); - AngleLimits (Prev_Theta1_Gear, Prev_Theta2_Gear, Prev_x, Prev_y); // laatste check + //AngleLimits (Prev_Theta1_Gear, Prev_Theta2_Gear, Prev_x, Prev_y); // laatste check } ////////////////////////// Code for control ///////////////////////////////////// @@ -599,8 +599,8 @@ scope.set(4,m1_MotorValue); scope.set(5,m2_MotorValue); // Set the motorvalues - // SetMotor(1, m1_MotorValue); - // SetMotor(2, m2_MotorValue); + SetMotor(1, m1_MotorValue); + SetMotor(2, m2_MotorValue); // Set motorvalues for scope // Send data to HIDScope scope.send(); @@ -662,6 +662,7 @@ // Set baud connection with PC pc.baud(SERIAL_BAUD); pc.printf("\r\n ***THERMONUCLEAR WARFARE COMMENCES*** \r\n"); + pc.printf("\r\n *** PROGRAM: CompleteFunction *** \r\n"); /* making the biquad chain for filtering the emg notch and high pass */ @@ -694,11 +695,11 @@ pc.printf("\r\n Press Button 1 to start positioning the arms using PotControl\r\n"); pc.printf("\r\n Make sure both potentiometers are positioned halfway! \r\n"); pc.printf("\r\n ***************** \r\n"); - pc.printf("\r\n Button1_value = %d \r\n", button1_value); + //pc.printf("\r\n Button1_value = %d \r\n", button1_value); while (button1_value == false) { - pc.printf("\r\n Button1_value = %d \r\n", button1_value); - wait(5); + //pc.printf("\r\n Button1_value = %d \r\n", button1_value); + //wait(5); } PotControlTicker.attach(&PotControl,CONTROLLER_TS); @@ -707,8 +708,8 @@ pc.printf("\r\n ***************** \r\n"); while (button1_value == true) { - pc.printf("\r\n Button1_value = %d \r\n", button1_value); - wait(5); + //pc.printf("\r\n Button1_value = %d \r\n", button1_value); + //wait(5); } // Detach potcontrol @@ -729,8 +730,8 @@ pc.printf("\r\n ***************** \r\n"); while (button1_value == false) { - pc.printf("\r\n Button1_value = %d \r\n", button1_value); - wait(5); + //pc.printf("\r\n Button1_value = %d \r\n", button1_value); + //wait(5); } // Attach sample, calc and control tickers