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.
AF_TB6612FNG.cpp
00001 #include "AF_TB6612FNG.h" 00002 #include "mbed.h" 00003 00004 AF_TB6612FNG::AF_TB6612FNG(PinName pwma, PinName ain1, PinName ain2, PinName pwmb, PinName bin1, PinName bin2, PinName standby) 00005 : _motorL(pwma,ain1,ain2),_motorR(pwmb,bin1,bin2),_standby(standby) { 00006 _isForward = false; 00007 _standby = 1; 00008 } 00009 00010 void AF_TB6612FNG::stop() 00011 { 00012 _motorL = 0; 00013 _motorR = 0; 00014 _isForward = false; 00015 } 00016 00017 void AF_TB6612FNG::forward(float speed) 00018 { 00019 _motorL = speed; 00020 _motorR = speed; 00021 _isForward = true; 00022 } 00023 00024 void AF_TB6612FNG::backward(float speed) 00025 { 00026 _motorL = -1*speed; 00027 _motorR = -1*speed; 00028 _isForward = false; 00029 } 00030 00031 void AF_TB6612FNG::left(float speed) 00032 { 00033 _motorL = -1*speed; 00034 _motorR = speed; 00035 _isForward = false; 00036 } 00037 00038 void AF_TB6612FNG::right(float speed) 00039 { 00040 _motorL = speed; 00041 _motorR = -1*speed; 00042 _isForward = false; 00043 } 00044 00045 bool AF_TB6612FNG::isForward() { 00046 return _isForward; 00047 }
Generated on Tue Jul 19 2022 22:26:55 by
 1.7.2
 1.7.2