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 MODSERIAL QEI biquadFilter mbed
Fork of Motor_EMG_FinalV1 by
Revision 4:92a3b38a5302, committed 2015-10-26
- Comitter:
- Rvs94
- Date:
- Mon Oct 26 19:56:49 2015 +0000
- Parent:
- 3:86ca263a83dc
- Child:
- 5:98cf456b08d7
- Commit message:
- Werkende PID regelaar met EMG aansturing. nieuwe K constanten nog niet toevoegd.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Oct 22 10:59:03 2015 +0000
+++ b/main.cpp Mon Oct 26 19:56:49 2015 +0000
@@ -48,8 +48,8 @@
double position2 = 0, position1 = 0;
double m2_ref = 0, m1_ref = 0;
int count = 0;
- double Grens2 = 90, Grens1 = 90;
- double Stapgrootte = 5;
+ double Grens2 = 70, Grens1 = 70;
+ double Stapgrootte = 1;
// Declaring variables
double EMG_L_f_v1 = 0, EMG_L_f_v2 = 0;
@@ -324,24 +324,24 @@
if ((EMG_right_MAF >= Threshold3) && (EMG_left_MAF <= Threshold1)) //if(c == 'r') //
{
m2_ref = m2_ref + Stapgrootte;
- m1_ref = m1_ref - Stapgrootte;
+ m1_ref = m1_ref + Stapgrootte;
if (m2_ref > Grens2)
{
m2_ref = Grens2;
- m1_ref = -1*Grens1;
+ m1_ref = Grens1;
}
- wait(0.1);
+ wait(0.05);
}
if((EMG_right_MAF < Threshold3) && (EMG_left_MAF > Threshold1)) //if (c == 'f') //
{
m2_ref = m2_ref - Stapgrootte;
- m1_ref = m1_ref + Stapgrootte;
+ m1_ref = m1_ref - Stapgrootte;
if (m2_ref < -1*Grens2)
{
m2_ref = -1*Grens2;
- m1_ref = Grens1;
+ m1_ref = -1*Grens1;
}
- wait(0.1);
+ wait(0.05);
}
}
// PROGRAM 1: Motor 1 control, Red LED
@@ -349,7 +349,7 @@
{
LedG = LedB = 1;
LedR = 0;
- if ((EMG_right_MAF >= Threshold3) && (EMG_left_MAF <= Threshold1)) // if(c == 't') //
+ if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1)) // if(c == 't') //
{
m1_ref = m1_ref + Stapgrootte;
@@ -357,9 +357,9 @@
{
m1_ref = Grens1;
}
- wait(0.1);
+ wait(0.05);
}
- if ((EMG_left_MAF > Threshold1) && (EMG_right_MAF < Threshold3)) //if(c == 'g') //
+ if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3)) //if(c == 'g') //
{
m1_ref = m1_ref - Stapgrootte;
@@ -367,7 +367,7 @@
{
m1_ref = -1*Grens1;
}
- wait(0.1);
+ wait(0.05);
}
}
// PROGRAM 2: Firing mechanism & Reset, Blue LED
