"werkend script"

Dependencies:   Encoder HIDScope MODSERIAL mbed

Fork of TotalCodegr13V2 by Rianne Bulthuis

Files at this revision

API Documentation at this revision

Comitter:
riannebulthuis
Date:
Mon Nov 02 12:48:13 2015 +0000
Parent:
14:25edcf2935f6
Commit message:
laatste update

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 12:48:13 2015 +0000
@@ -242,11 +242,11 @@
     if (safety_stop == true && (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;
+        motor1_speed = 0.15;
     } else if (safety_stop == true && (final_filter2 > 0.05 && final_filter1 < 0.02 && final_filter3 < 0.04 && final_filter4 < 0.04)) {
         pc.printf("motor1 ccw \n\r");
         motor1_direction = 0; //counterclockwise
-        motor1_speed = 0.1  ;
+        motor1_speed = 0.15  ;
     } else {
         pc.printf("Not moving1 \n\r");
         motor1_speed = 0;
@@ -255,14 +255,14 @@
 
 void move_motor2()
 {
-    if (safety_stop == true && (final_filter3 > 0.04 && final_filter1 < 0.02 && final_filter2 < 0.02 && final_filter4 < 0.02)) {
+    if (safety_stop == true && (final_filter3 > 0.025 && final_filter4 < 0.02)) {
+        pc.printf("motor2 ccw \n\r");
+        motor2_direction = 0; //counterclockwise
+        motor2_speed = 1;
+    } else if (safety_stop == true && (final_filter4 > 0.025 && final_filter3 < 0.02)) {
         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)) {
-        pc.printf("motor2 ccw \n\r");
-        motor2_direction = 0; //counterclockwise
-        motor2_speed = 0.4;
+        motor2_speed = 1;
         }
          else if (P2 > 500) {
         safety_stop = false;
@@ -300,12 +300,6 @@
     } else if (P1 < -24) {
         motor1_direction = 0;
         motor1_speed = 0.1;
-    } else if (P2 > 24) {
-        motor2_direction = 1;
-        motor2_speed = 0.1;
-    } else if (P2 < -24) {
-        motor2_direction = 0;
-        motor2_speed = 0.1;
     }
 }