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 Controllertest2 by
Revision 5:bb77e2a6c1e8, committed 2016-10-25
- Comitter:
- LeeJon
- Date:
- Tue Oct 25 11:13:13 2016 +0000
- Parent:
- 4:e59a99c5aa08
- Commit message:
- om servo te testen
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| servoController.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 25 10:36:50 2016 +0000
+++ b/main.cpp Tue Oct 25 11:13:13 2016 +0000
@@ -88,7 +88,7 @@
emgSampleTicker.attach( &emgSample, 0.002);
treshold = (cali_max-cali_min)*treshold_multiplier;
- servoTick.attach(&control_servo, 1/Frequency);
+// servoTick.attach(&control_servo, 1/Frequency);
ServoPWMpin.period(0.01f); // 0.01 second period
while (true) {
@@ -101,18 +101,15 @@
if (Controller_Flag == true){
Slide_Controller();
Lift_Controller();
- control_servo();
+ control_servo(Norm_EMG_0);
Controller_Flag = false;
}
-
-
-
-
}
return 0;
}
+
void Ticker_Flag(){
Controller_Flag = true;
}
--- a/servoController.h Tue Oct 25 10:36:50 2016 +0000
+++ b/servoController.h Tue Oct 25 11:13:13 2016 +0000
@@ -9,7 +9,7 @@
double ServoAngle = 89 ;
float Pulsew = 0.0015;
const float Frequency = 10;
-double input_signal = 0;
+//double input_signal = 0;
double cali_min = 0;
double cali_max = 1;
double treshold = 0.5;
@@ -17,7 +17,7 @@
bool binary_input_signal = 0;
bool binary_input_signal_previous = 0;
-void control_servo(){
+void control_servo(double input_signal){
if (input_signal > treshold){ // convert the emg to a zero or a one
binary_input_signal = 1;
} else {
