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 4:53e02c276f23, committed 2014-10-05
- Comitter:
- Throwbot
- Date:
- Sun Oct 05 12:20:35 2014 +0000
- Parent:
- 3:cb336a5cf19e
- Commit message:
- Motor Driver change
Changed in this revision
| TB6612.cpp | Show annotated file Show diff for this revision Revisions of this file |
| TB6612.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/TB6612.cpp Fri May 09 14:49:33 2014 +0000
+++ b/TB6612.cpp Sun Oct 05 12:20:35 2014 +0000
@@ -23,7 +23,7 @@
// arg
// int speed -100 -- 0 -- 100
void TB6612::speed(int speed_) {
-
+ _speed = speed_;
float speed = scale*(float)speed_;
if( speed > 0 )
@@ -44,3 +44,7 @@
_rev = 1;
}
}
+int TB6612::getSpeed(){
+ return _speed;
+}
+
--- a/TB6612.h Fri May 09 14:49:33 2014 +0000
+++ b/TB6612.h Sun Oct 05 12:20:35 2014 +0000
@@ -14,7 +14,8 @@
class TB6612 {
public:
- int scale;
+ float scale;
+ int _speed; //save control input
TB6612(PinName pwm, PinName fwd, PinName rev);
@@ -23,6 +24,7 @@
{
speed(value);
}
+ int getSpeed();
protected:
PwmOut _pwm;