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.
Revision 1:201d986498c7, committed 2014-10-05
- Comitter:
- Throwbot
- Date:
- Sun Oct 05 12:20:47 2014 +0000
- Parent:
- 0:5b2bf6e79b07
- Commit message:
- Motors code
Changed in this revision
| motors.cpp | Show annotated file Show diff for this revision Revisions of this file |
| motors.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/motors.cpp Thu May 08 19:11:31 2014 +0000
+++ b/motors.cpp Sun Oct 05 12:20:47 2014 +0000
@@ -14,4 +14,14 @@
Left->scale *= -1;
Right->scale *= -1;
-}
\ No newline at end of file
+}
+void Motors::reverse(bool m)
+{
+ if(m)
+ Right->scale *= -1; //reverse right motor
+ else
+ Left->scale *= -1; //reverse left motor
+}
+
+//TODO: write in a function that automatically sets the motors to be oriented properly. Use the
+//gyroscopes and accelerometer to do this.
\ No newline at end of file
--- a/motors.h Thu May 08 19:11:31 2014 +0000
+++ b/motors.h Sun Oct 05 12:20:47 2014 +0000
@@ -18,6 +18,7 @@
Motors(TB6612 * L, TB6612 * R, PinName STBY);
- void flip();
+ void flip();
+ void reverse(bool m); //reverse one of the motors (0=right, 1=left)
};
#endif
\ No newline at end of file