Schulaufgabe 21.12.2015

Dependencies:   HCSR

Fork of Bertl by Franz Pucher

Revision:
2:1cd559ff516b
Parent:
1:fafbac0ba96d
Child:
3:01b183fe8b41
--- a/ur_Bertl.cpp	Thu Mar 19 19:12:33 2015 +0000
+++ b/ur_Bertl.cpp	Thu Mar 26 12:39:40 2015 +0000
@@ -37,6 +37,9 @@
     int count = _count;
     MotorR_EN=MotorL_EN=1;                  // both motor ENABLE
     MotorR_FORWARD = MotorL_FORWARD = 1;    // both motor forward ON
+#ifdef TIME
+    wait_ms(MOVE);
+#else    
 
     while(_count < count+DISTANCE) {
         //if(!FrontIsClear())       // more convenient because there are no accidents :-)
@@ -47,6 +50,7 @@
 #endif
         DEBUG_PRINT("count: %d _count: %d", count, _count);
     }
+#endif
     MotorR_FORWARD = MotorL_FORWARD = 0;    // both motor off
     MotorR_EN=MotorL_EN=0;
     wait_ms(250);
@@ -76,6 +80,10 @@
     MotorR_EN=MotorL_EN=1;                  // motor left and right ENABLE
 
     MotorR_FORWARD = MotorL_REVERSE = 1;
+#ifdef TIME
+    wait_ms(TURN);
+#else
+
     while(_count < count+ANGLE) {
 #ifdef FRONTBUTTON
         if(frontButtonPressed())            // get out if to much problems
@@ -83,6 +91,7 @@
 #endif
         DEBUG_PRINT("count: %d _count: %d", count, _count);
     }
+#endif
     MotorR_FORWARD = MotorL_REVERSE = 0;
     MotorR_EN=MotorL_EN=0;
     wait_ms(250);           // only to step the robot