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: HIDScope QEI biquadFilter mbed
Fork of EMG_Controller_5 by
Diff: servoController.h
- Revision:
- 7:eed677b636d3
- Parent:
- 6:6cb7c0247560
- Child:
- 8:aa03407660f1
--- a/servoController.h Tue Oct 25 12:07:53 2016 +0000 +++ b/servoController.h Tue Oct 25 12:35:29 2016 +0000 @@ -1,19 +1,11 @@ #include "mbed.h" Serial pc(USBTX,USBRX); +PwmOut ServoPWMpin(D9); -PwmOut ServoPWMpin(D9); -Ticker servoTick; -float i = 0; -char Key; double ServoAngle = 89 ; float Pulsew = 0.0015; -const float Frequency = 10; -//double input_signal = 0; -double cali_min = 0; -double cali_max = 1; double treshold = 0.3; -float treshold_multiplier = 0.5; bool binary_input_signal = 0; bool binary_input_signal_previous = 0; @@ -37,40 +29,4 @@ pc.printf("\n\r Pulsew is %f",Pulsew); binary_input_signal_previous = binary_input_signal; -} -/* -int main(){ - pc.printf("\n\r ----------------------------------------\n\r --------------- START -----------------\n\r ----------------------------------------"); - treshold = (cali_max-cali_min)*treshold_multiplier; - servoTick.attach(&control_servo, 1/Frequency); - ServoPWMpin.period(0.01f); // 0.01 second period - - while (true) { - Key = pc.getc(); // get the pressed key - switch(Key) { //Check to see which key pressed - case 0x2B: //It was the + key... - pc.printf("\n\r +!"); - if( ServoAngle < 80){ - ServoAngle = ServoAngle+10; // increase the angle - } - break; - case 0x2D: //It was the - Key key... - pc.printf("\n\r -!"); - if( ServoAngle > 10){ - ServoAngle = ServoAngle-10; // decrease the angle - } - break; - case 0x20: //It was the Spacebar key... - pc.printf("\n\r SPACE!"); - if( ServoAngle < 45){ // Switch from open to closed or else otherwise - ServoAngle = 89; // open/close - } - else{ - ServoAngle = 1; // open/close - } - break; - } - - } -} -*/ \ No newline at end of file +} \ No newline at end of file