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: Encoder HIDScope MODSERIAL mbed
Fork of TotalCodegr13V2 by
Revision 15:ece330b45d93, committed 2015-11-02
- Comitter:
- arunr
- Date:
- Mon Nov 02 14:03:45 2015 +0000
- Parent:
- 14:25edcf2935f6
- Child:
- 16:bf76ed65da88
- Commit message:
- home pos arm 1 werkt;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Oct 29 22:56:57 2015 +0000
+++ b/main.cpp Mon Nov 02 14:03:45 2015 +0000
@@ -43,7 +43,7 @@
// Berekening van de output shaft resolution. Het aantal counts per 1 graden verandering (PI-controller)
const double g = 360; // Aantal graden 1 rotatie
const double c = 4200; // Aantal counts 1 rotatie
-const double q = c/(g);
+const double q = g/c;
//PI-controller constante
const double motor1_Kp = 2.0; // Dit is de proportionele gain motor 1
@@ -239,7 +239,7 @@
void move_motor1()
{
- if (safety_stop == true && (final_filter1 > 0.05 && final_filter2 < 0.02 && final_filter3 < 0.04 && final_filter4 < 0.04)) {
+ if (button_1 == pressed || (final_filter1 > 0.05 && final_filter2 < 0.02 && final_filter3 < 0.04 && final_filter4 < 0.04)) {
pc.printf("motor1 cw \n\r");
motor1_direction = 1; //clockwise
motor1_speed = 0.1;
@@ -259,7 +259,7 @@
pc.printf("motor2 cw \n\r");
motor2_direction = 1; //clockwise
motor2_speed = 0.4;
- } else if (safety_stop == true && (final_filter4 > 0.03 && final_filter1 < 0.02 && final_filter2 < 0.02 && final_filter3 < 0.02)) {
+ } else if (button_2 == pressed || (final_filter4 > 0.03 && final_filter1 < 0.02 && final_filter2 < 0.02 && final_filter3 < 0.02)) {
pc.printf("motor2 ccw \n\r");
motor2_direction = 0; //counterclockwise
motor2_speed = 0.4;
