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 7:111e13da9bc0, committed 2015-10-28
- Comitter:
- Rvs94
- Date:
- Wed Oct 28 11:02:42 2015 +0000
- Parent:
- 6:d1d747050fcc
- Child:
- 8:86a13efe98c8
- Commit message:
- Grenzen voor motor 1 toegevoegd, nog niet getest
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 27 11:47:32 2015 +0000
+++ b/main.cpp Wed Oct 28 11:02:42 2015 +0000
@@ -261,7 +261,7 @@
wait(0.2);
LedG.write(0);
wait(2);
- Threshold1 = 0.8*EMG_left_MAF;
+ Threshold1 = 0.5*EMG_left_MAF;
Threshold2 = 0.2*EMG_left_MAF;
LedG.write(1);
LedR.write(0);
@@ -281,7 +281,7 @@
wait(0.2);
LedB.write(0);
wait(2);
- Threshold3 = 0.8*EMG_right_MAF;
+ Threshold3 = 0.5*EMG_right_MAF;
Threshold4 = 0.2*EMG_right_MAF;
LedB.write(1);
pc.printf("T1 = %f, T2 = %f, T3 = %f, T4 = %f\n", Threshold1, Threshold2, Threshold3, Threshold4);
@@ -349,17 +349,39 @@
{
LedG = LedB = 1;
LedR = 0;
- if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1)) // if(c == 't') //
+ //Linker grenzen
+ if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1) && (m2_ref > 0)) // if(c == 't') //
{
m1_ref = m1_ref + Stapgrootte;
- if (m1_ref > Grens1)
+ if (m1_ref > -1*m2_ref + 80 )
{
- m1_ref = Grens1;
+ m1_ref = -1*m2_ref + 80;
}
wait(0.05);
}
- if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3)) //if(c == 'g') //
+ if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3) && (m2_ref > 0)) //if(c == 'g') //
+ {
+ m1_ref = m1_ref - Stapgrootte;
+
+ if (m1_ref < -1*Grens1)
+ {
+ m1_ref = -1*Grens1;
+ }
+ wait(0.05);
+ }
+ //Rechter grenzen
+ if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1) && (m2_ref <= 0)) // if(c == 't') //
+ {
+ m1_ref = m1_ref + Stapgrootte;
+
+ if (m1_ref > -1*m2_ref - 80 )
+ {
+ m1_ref = -1*m2_ref - 80;
+ }
+ wait(0.05);
+ }
+ if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3) && (m2_ref <= 0)) //if(c == 'g') //
{
m1_ref = m1_ref - Stapgrootte;
