Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Bertl by
Revision 2:1cd559ff516b, committed 2015-03-26
- Comitter:
- bulmecisco
- Date:
- Thu Mar 26 12:39:40 2015 +0000
- Parent:
- 1:fafbac0ba96d
- Child:
- 3:01b183fe8b41
- Commit message:
- Time for TurnLeft and Move added
Changed in this revision
| const.h | Show annotated file Show diff for this revision Revisions of this file |
| ur_Bertl.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/const.h Thu Mar 19 19:12:33 2015 +0000 +++ b/const.h Thu Mar 26 12:39:40 2015 +0000 @@ -8,6 +8,9 @@ */ #ifndef CONST_H #define CONST_H +//#define TIME +const int MOVE=500; +const int TURN=500; /*! \var int SPEED \brief Bertl speed 0.2 (slow) - 1.0 (fast).
--- 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
