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_Controllertest_servo by
Diff: servoController.h
- Revision:
- 8:aa03407660f1
- Parent:
- 7:eed677b636d3
diff -r eed677b636d3 -r aa03407660f1 servoController.h
--- a/servoController.h Tue Oct 25 12:35:29 2016 +0000
+++ b/servoController.h Wed Oct 26 07:59:31 2016 +0000
@@ -2,13 +2,19 @@
Serial pc(USBTX,USBRX);
PwmOut ServoPWMpin(D9);
+Timeout resetter;
+bool readtime = 1;
double ServoAngle = 89 ;
float Pulsew = 0.0015;
double treshold = 0.3;
bool binary_input_signal = 0;
bool binary_input_signal_previous = 0;
+void set21(){
+ readtime = 1;
+}
+
void control_servo(double input_signal){
pc.printf("/n/r %f", input_signal);
if (input_signal > treshold){ // convert the emg to a zero or a one
@@ -16,7 +22,9 @@
} else {
binary_input_signal = 0;
}
- if(( binary_input_signal!= binary_input_signal_previous)&& binary_input_signal){
+ if((( binary_input_signal!= binary_input_signal_previous)&& binary_input_signal)&& readtime){
+ readtime = 0;
+ resetter.attach(&set21, 1);
if( ServoAngle < 45){ // check wether it is more opened or closed
ServoAngle = 89; // open
}
