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 Servo mbed QEI biquadFilter
Diff: THE.cpp
- Revision:
- 19:a3a7baab9dbc
- Parent:
- 18:db53ac017f50
- Child:
- 20:645483d7470c
--- a/THE.cpp Thu Nov 01 14:28:56 2018 +0000
+++ b/THE.cpp Thu Nov 01 14:34:36 2018 +0000
@@ -477,7 +477,7 @@
wait(0.001f);
}
Mean0 = sum/sizeCali; // Calculates the mean of the signal
- Threshold0 = Mean0; // Factor *2 is for resting and *1 is for max contraction
+ Threshold0 = 2.0*Mean0; // Factor *2 is for resting and *1 is for max contraction
break;
}
case 1:
@@ -490,7 +490,7 @@
wait(0.001f);
}
Mean1 = sum/sizeCali;
- Threshold1 = Mean1; // Factor *2 is for resting and *1 is for max contraction
+ Threshold1 = 2.0*Mean1; // Factor *2 is for resting and *1 is for max contraction
break;
}
case 2:
@@ -503,7 +503,7 @@
wait(0.001f);
}
Mean2 = sum/sizeCali;
- Threshold2 = Mean2; //Factor *2 is for resting and *1 is for max contraction
+ Threshold2 = 2.0*Mean2; //Factor *2 is for resting and *1 is for max contraction
break;
}
case 3:
@@ -616,7 +616,7 @@
pc.printf("\r\n direction = Pos_LB\r\n");
directionchanged = true;
}
-
+ wait(3.0); // wait 3 seconds, otherwise it goes directly to the next case
break;
case Pos_LB:
@@ -634,7 +634,7 @@
pc.printf("\r\n direction = Pos_RO\r\n");
directionchanged = true;
}
-
+ wait(3.0);
break;
case Pos_RO:
@@ -652,7 +652,7 @@
pc.printf("\r\n direction = Pos_LO\r\n");
directionchanged = true;
}
-
+ wait(3.0);
break;
case Pos_LO:
@@ -670,11 +670,10 @@
pc.printf("\r\n direction = Pos_RB\r\n");
directionchanged = true;
}
-
+ wait(3.0);
break;
}
- }
-
+ }
// PID controller
// To control the input signal before it goes into the motor control