final

Dependencies:   Encoder HIDScope MODSERIAL TouchButton mbed-dsp mbed

Fork of Robot1_11 by BMT M9 Groep01

Revision:
1:5d30a2ea2e11
Parent:
0:1594bb11fa13
Child:
2:455216d1b5ba
--- a/main.cpp	Thu Oct 30 12:21:27 2014 +0000
+++ b/main.cpp	Thu Oct 30 13:18:42 2014 +0000
@@ -78,7 +78,7 @@
 float new_pwm;
 float PWM2 = 0.3; //PWM voor instellen hoek batje
 int toestand = TERUGKEREN;
-float setspeed = 0, V3=60, V2=40, V1 =30, Vreturn= 15;//V in counts/s
+float setspeed = 0, V3=60, V2=40, V1 =30, Vreturn= 35;//V in counts/s
 
 
 Encoder motor1(PTD5,PTD3);
@@ -628,20 +628,22 @@
         }
     }
     if (toestand == SLAAN && abs(motor1.getPosition()) >= ANGLEMAX) {
+        pc.printf("toestand = terugkeren\n\r");
         toestand = TERUGKEREN; 
         stop = 1; //zorgt dat hij niet weer gaat slaan tot er gereset is...
     }
     if (toestand == TERUGKEREN) {
+        pc.printf("motor gaat terugkeren\n\r");
         new_pwm = pid(Vreturn, motor1.getSpeed());
         pwm_motor1.write(new_pwm);
-        motordir1 = 1;
+        motordir1 = 0;
     }
     if (toestand == WACHTEN) {
         pwm_motor1.write(0);
     }
     if (toestand == SLAAN) {
         new_pwm = pid(setspeed, motor1.getSpeed());
-        motordir1 = 0;
+        motordir1 = 1;
         pwm_motor1.write(new_pwm);
     }
 }
\ No newline at end of file