Satoshi Iyobe / TB6612FNG

Dependents:   measure_1_BBB measure_1_CCC measure_1_DDD

Files at this revision

API Documentation at this revision

Comitter:
sato_shi
Date:
Thu May 13 05:11:37 2021 +0000
Parent:
0:085abb7f6992
Commit message:
BBBBBBb;

Changed in this revision

TB6612FNG.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 085abb7f6992 -r 4c4f2d25dc05 TB6612FNG.cpp
--- a/TB6612FNG.cpp	Fri May 07 03:27:26 2021 +0000
+++ b/TB6612FNG.cpp	Thu May 13 05:11:37 2021 +0000
@@ -13,8 +13,11 @@
 }
 
 void TB6612FNG::SetW(float W)
-{
-    _PWM = W;
+{   
+    if(0 <= W && W <= 1) _PWM = W;
+    else if(1 < W) _PWM = 1;
+    else _PWM = 0;
+    
 }
 
 void TB6612FNG::Forward()