First import from throwbot

Fork of TB6612FNG2 by Junichi Katsu

Files at this revision

API Documentation at this revision

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
diff -r cb336a5cf19e -r 53e02c276f23 TB6612.cpp
--- 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;
+}
+
diff -r cb336a5cf19e -r 53e02c276f23 TB6612.h
--- 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;