robot

Dependencies:   Encoder HIDScope MODSERIAL TouchButton mbed-dsp mbed

Fork of Robot2false by BMT M9 Groep01

Revision:
15:737f5f448eb7
Parent:
14:1ff917c6ac45
Child:
16:8e56aa6f4b7a
--- a/main.cpp	Fri Oct 31 09:21:39 2014 +0000
+++ b/main.cpp	Fri Oct 31 09:40:30 2014 +0000
@@ -643,11 +643,11 @@
         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(setspeed, motor1.getSpeed(),false); 
         pwm_motor1.write(new_pwm);
+        motordir1 = 0;
+        pc.printf("motor gaat terugkeren\n\r");
         pc.printf("new pwm %f\r\n",new_pwm);
-        motordir1 = 0;
     }
     if (toestand == WACHTEN) {
         pwm_motor1.write(0);
@@ -655,8 +655,8 @@
     }
     if (toestand == SLAAN) {
         new_pwm = pid(setspeed, motor1.getSpeed(),false);
+        pwm_motor1.write(new_pwm);
         motordir1 = 1;
-        pwm_motor1.write(new_pwm);
         pc.printf("SLAAN\n");
         
     }