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.
Dependencies: Encoder HIDScope MODSERIAL QEI biquadFilter mbed
Diff: main.cpp
- Revision:
- 48:950b1f34161b
- Parent:
- 47:c61873a0b646
- Child:
- 49:a8a68abf814f
--- a/main.cpp Wed Oct 14 21:26:02 2015 +0000 +++ b/main.cpp Thu Oct 15 11:03:53 2015 +0000 @@ -68,10 +68,10 @@ // Main // Start of code.............................................. -// calibrate.................................................. -// starting position motor.............................. -// EMG calibration...................................... -// Attach Ticker.............................................. +// calibrate.................................................. +// starting position motor.............................. (RED LED) +// EMG calibration...................................... (BLUE LED) +// Attach Ticker.............................................. // Start infinite loop........................................ // Debug buttons........................................ // Wait for go signal................................... @@ -139,8 +139,8 @@ // : [Potmeter] : // :__________________________: // DEBUGGING / TESTING -//moving_average_right = (potmeter1.read())*100; // EMG Right bicep (tussen nul en 100%) -//moving_average_left = (potmeter2.read())*100; // EMG Left bicep (tussen nul en 100%) +//moving_average_right = (input1.read())*100; // EMG Right bicep (tussen nul en 100%) +//moving_average_left = (input2.read())*100; // EMG Left bicep (tussen nul en 100%) // __________________________ // : [FLOW] : @@ -153,7 +153,7 @@ // :__________________________: // -HIDScope scope(3); // HIDSCOPE declared +//HIDScope scope(3); // HIDSCOPE declared MODSERIAL pc(USBTX,USBRX); //============================================================================================================================ @@ -391,20 +391,26 @@ if (buttonL2.read() < 0.5){ // TURN: turn the motor clockwise with pwm of 0.2 motordirection_turn = cw; - pwm_motor_turn = 0.2f;} + pwm_motor_turn = 0.02; + pc.printf("cw calibration \n\r");} if (buttonL1.read() < 0.5){ // TURN: turn the motor counterclockwise with pwm of 0.2 motordirection_turn = ccw; - pwm_motor_turn = 0.2f;} + pwm_motor_turn = 0.02; + pc.printf("ccw calibration \n\r");} + + pwm_motor_turn = 0; // STRIKE: HIGH buttons // if (buttonH2.read() < 0.5){ // STRIKE: turn the motor clockwise with pwm of 0.2 // motordirection_strike = cw; -// pwm_motor_turn = 0.2f;} +// pwm_motor_strike = 0.02;} // // if (buttonH1.read() < 0.5){ // STRIKE: turn the motor clockwise with pwm of 0.2 // motordirection_strike = ccw; -// pwm_motor_turn = 0.2f;} +// pwm_motor_strike = 0.02;} + +// pwm_motor_strike = 0; // if ((buttonL2.read() < 0.5) && (buttonL1.read() < 0.5)) // Save current TURN and STRIKE positions as starting position { @@ -507,7 +513,11 @@ // \\___________________________// // debug_led_green = on; // - sample_filter(); + //sample_filter(); + moving_average_right = (input1.read())*100; // EMG Right bicep (tussen nul en 100%) // DEBUG TEST TOOL: substitute EMG input for potmeter inputs + moving_average_left = (input2.read())*100; // EMG Left bicep (tussen nul en 100%) // DEBUG TEST TOOL: substitute EMG input for potmeter inputs + pc.printf("mov_r = %f, mov_r = %f \n\r", moving_average_right, moving_average_left); + // scope.set(0,EMG_left_Bicep); // scope.set(1,EMG_Left_Bicep_filtered); // scope.set(2,moving_average_left); @@ -705,10 +715,10 @@ // \\___________________________// // // Check signals inside HIDSCOPE \\ - scope.set(0,error_turn); // HIDSCOPE channel 0 : Current Error - scope.set(1,position_turn); // HIDSCOPE channel 1 : Position_turn - scope.set(2,pwm_to_motor_turn); // HIDSCOPE channel 2 : Pwm_to_motor_turn - scope.send(); // Send channel info to HIDSCOPE + //scope.set(0,error_turn); // HIDSCOPE channel 0 : Current Error + //scope.set(1,position_turn); // HIDSCOPE channel 1 : Position_turn + //scope.set(2,pwm_to_motor_turn); // HIDSCOPE channel 2 : Pwm_to_motor_turn + //scope.send(); // Send channel info to HIDSCOPE // __________________________________ // // \\