BMT M9 Groep01 / Mbed 2 deprecated Robot2

Dependencies:   Encoder HIDScope MODSERIAL TouchButton mbed-dsp mbed

Files at this revision

API Documentation at this revision

Comitter:
Tanja2211
Date:
Thu Oct 30 14:05:36 2014 +0000
Parent:
1:5d30a2ea2e11
Child:
3:68b364036bc8
Commit message:
gaat heen en terug en stopt niet

Changed in this revision

TouchButton.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TouchButton.lib	Thu Oct 30 13:18:42 2014 +0000
+++ b/TouchButton.lib	Thu Oct 30 14:05:36 2014 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/BMT-M9-Groep01/code/TouchButton/#6153458ce46b
+http://developer.mbed.org/teams/BMT-M9-Groep01/code/TouchButton/#956d0575205b
--- a/main.cpp	Thu Oct 30 13:18:42 2014 +0000
+++ b/main.cpp	Thu Oct 30 14:05:36 2014 +0000
@@ -611,8 +611,9 @@
 void motor1aansturing()
 {
 
-    if (motor1.getPosition()<= ANGLEMIN && toestand != SLAAN) {
+    if (abs(motor1.getPosition())<= ANGLEMIN && toestand != SLAAN) {
         toestand = WACHTEN; 
+        pc.printf("if1\n");
     }
     if (snelheidsstand != 0 && toestand == WACHTEN && stop == 0) { // stop = 0 in het begin let op dat dit na reset nog zo is
         toestand = SLAAN;
@@ -634,16 +635,20 @@
     }
     if (toestand == TERUGKEREN) {
         pc.printf("motor gaat terugkeren\n\r");
-        new_pwm = pid(Vreturn, motor1.getSpeed());
-        pwm_motor1.write(new_pwm);
+        //pid(Vreturn, motor1.getSpeed());
+        pwm_motor1.write(0.5);
+        pc.printf("new pwm %f\r\n",new_pwm);
         motordir1 = 0;
     }
     if (toestand == WACHTEN) {
         pwm_motor1.write(0);
+        pc.printf("ifwachten\n");
     }
     if (toestand == SLAAN) {
         new_pwm = pid(setspeed, motor1.getSpeed());
         motordir1 = 1;
         pwm_motor1.write(new_pwm);
+        pc.printf("SLAAN\n");
+        
     }
 }
\ No newline at end of file