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: BioroboticsMotorControl mbed BioroboticsEMGFilter MODSERIAL
Revision 6:656fb0834a1a, committed 2018-10-31
- Comitter:
- MAHCSnijders
- Date:
- Wed Oct 31 12:45:43 2018 +0000
- Parent:
- 5:43aa136aecda
- Child:
- 7:5cbb59d98416
- Commit message:
- Versie waarin motor 1 werkt en motor 2 niet;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 31 12:44:47 2018 +0000
+++ b/main.cpp Wed Oct 31 12:45:43 2018 +0000
@@ -57,28 +57,29 @@
if (current_angle2 - motor_threshold <= last_angle2 && last_angle2 <= current_angle2 + motor_threshold) // If the motor angle is within a margin of the current motor angle
{
time_passed_in_this_state2++;
- calibLED1 = !calibLED1; // LED turns blue
+ calibLED1 = !calibLED1; // LED becomes blue
}
else
{
- motor_angle2 = current_angle2;
- motor_angle2 = motor_angle2 - 30*motor_threshold; // Subtracting five degree angle from the current angle
+ motor_angle2 = motor2.get_current_angle();
+ motor_angle2 = motor_angle2 - 5*motor_threshold; // Subtracting five degree angle from the current angle
motor2.set_target_angle(motor_angle2);
time_passed_in_this_state2 = 0; // Set time passed in this state back to zero
- calibLED2 = !calibLED2; // LED turns red
+ calibLED2 = !calibLED2;
}
if (time_passed_in_this_state2 >= 10) // After 5 seconds have passed (10 times Ticker motor_calib)
{
motor2.define_current_angle_as_x_radians(-0.733038); // Defines beginstate motor 2 as -42 degrees
motor_calib2.detach(); // Stop looping the function
- calibLED3 = !calibLED3; // LED becomes red (purple if both motors are calibrated)
+ calibLED3 = 0; // LED becomes red (purple if both motors are calibrated)
+ wait(0.1f);
+ calibLED3 = !calibLED3;
}
-
+
last_angle2 = current_angle2;
}
-
int main()
{
calibLED1 = 1;