First import from throwbot

Fork of TB6612FNG2 by Junichi Katsu

Revision:
2:73cbc6028f7a
Parent:
1:051a7ecff13e
Child:
3:cb336a5cf19e
--- a/TB6612.cpp	Mon Nov 12 16:39:11 2012 +0000
+++ b/TB6612.cpp	Thu May 08 19:11:04 2014 +0000
@@ -11,7 +11,7 @@
 
 // TB6612 Class Constructor
 TB6612::TB6612(PinName pwm, PinName fwd, PinName rev):
-        _pwm(pwm), _fwd(fwd), _rev(rev) {
+        scale(1), _pwm(pwm), _fwd(fwd), _rev(rev) {
 
     _fwd = 0;
     _rev = 0;
@@ -23,16 +23,18 @@
 //  arg
 //   int speed -100 -- 0 -- 100
 void TB6612::speed(int speed) {
-        
+    
+    speed *= scale;
+    
     if( speed > 0 )
     {
-        _pwm = ((float)speed) / 100.0;
+        _pwm = ((float)speed)/ 100.0;
         _fwd = 1;
         _rev = 0;
     }
     else if( speed < 0 )
     {
-        _pwm = -((float)speed) / 100.0;
+        _pwm = -((float)speed)/ 100.0;
         _fwd = 0;
         _rev = 1;
     }
@@ -42,14 +44,3 @@
         _rev = 1;
     }
 }
-
-
-// Speed Control with time-out
-//  arg
-//   int speed -100 -- 0 -- 100
-//   int time  0
-void TB6612::move(int sspeed , int time)
-{
-    speed(sspeed);
-    wait_ms(time);
-}