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 2:d6cb78f523b0, committed 2018-06-04
- Comitter:
- tichise
- Date:
- Mon Jun 04 00:43:00 2018 +0000
- Parent:
- 1:47e5a7b22c0f
- Commit message:
- refactoring
Changed in this revision
| AF_TB6612FNG.cpp | Show annotated file Show diff for this revision Revisions of this file |
| AF_TB6612FNG.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/AF_TB6612FNG.cpp Mon Jun 04 00:36:29 2018 +0000
+++ b/AF_TB6612FNG.cpp Mon Jun 04 00:43:00 2018 +0000
@@ -11,6 +11,7 @@
{
_motorL = 0;
_motorR = 0;
+ _isForward = false;
}
void AF_TB6612FNG::forward(float speed)
@@ -20,27 +21,25 @@
_isForward = true;
}
-void AF_TB6612FNG::back(float speed)
+void AF_TB6612FNG::backward(float speed)
{
_motorL = -1*speed;
_motorR = -1*speed;
- _isForward = true;
+ _isForward = false;
}
void AF_TB6612FNG::left(float speed)
{
_motorL = -1*speed;
_motorR = speed;
+ _isForward = false;
}
void AF_TB6612FNG::right(float speed)
{
_motorL = speed;
_motorR = -1*speed;
-}
-
-void AF_TB6612FNG::setISForward(bool isForward) {
- _isForward = isForward;
+ _isForward = false;
}
bool AF_TB6612FNG::isForward() {
--- a/AF_TB6612FNG.h Mon Jun 04 00:36:29 2018 +0000
+++ b/AF_TB6612FNG.h Mon Jun 04 00:43:00 2018 +0000
@@ -10,11 +10,10 @@
AF_TB6612FNG(PinName pwma, PinName ain1, PinName ain2, PinName pwmb, PinName bin1, PinName bin2, PinName standby);
void stop();
void forward(float speed);
- void back(float speed);
+ void backward(float speed);
void left(float speed);
void right(float speed);
bool isForward();
- void setISForward(bool isForward);
private:
Moter _motorL;