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: main.cpp
- Revision:
- 4:e59a99c5aa08
- Parent:
- 3:1d43dd4f37eb
- Child:
- 5:bb77e2a6c1e8
diff -r 1d43dd4f37eb -r e59a99c5aa08 main.cpp
--- a/main.cpp Mon Oct 24 11:43:45 2016 +0000
+++ b/main.cpp Tue Oct 25 10:36:50 2016 +0000
@@ -1,6 +1,7 @@
#include "mbed.h"
#include "QEI.h"
+#include "servoController.h"
#include "emg.h"
#define pi 3.14159265359;
@@ -13,12 +14,12 @@
AnalogIn Potmeter2(A1);
QEI Slide_Encoder(D12,D13,NC,64);
QEI Lift_Encoder(D10,D11,NC,64);
-Serial pc(USBTX,USBRX);
+//Serial pc(USBTX,USBRX);
Ticker Controller;
-char Key;
+//char Key;
bool Controller_Flag=0;
-float Frequency = 30;
+//float Frequency = 30;
float Frequency_PWM = 10000;
float Slide_Radius = 12.5;
@@ -86,6 +87,10 @@
change_state2.attach( &run,10);
emgSampleTicker.attach( &emgSample, 0.002);
+ treshold = (cali_max-cali_min)*treshold_multiplier;
+ servoTick.attach(&control_servo, 1/Frequency);
+ ServoPWMpin.period(0.01f); // 0.01 second period
+
while (true) {
pc.printf("\n\r%f", Norm_EMG_0);
@@ -96,6 +101,8 @@
if (Controller_Flag == true){
Slide_Controller();
Lift_Controller();
+ control_servo();
+
Controller_Flag = false;
}
