BBBBBBBB

Dependents:   measure_1_BBB measure_1_CCC measure_1_DDD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TB6612FNG.cpp Source File

TB6612FNG.cpp

00001 #include "mbed.h"
00002 #include "TB6612FNG.h"
00003 
00004 TB6612FNG::TB6612FNG(PinName IN1, PinName IN2, PinName STBY, PinName PWM):
00005     _IN1(IN1), _IN2(IN2), _STBY(STBY), _PWM(PWM)
00006 {
00007     _PWM = 0;
00008 }
00009 
00010 void TB6612FNG::STBY(bool f)
00011 {
00012     _STBY = f;
00013 }
00014 
00015 void TB6612FNG::SetW(float W)
00016 {   
00017     if(0 <= W && W <= 1) _PWM = W;
00018     else if(1 < W) _PWM = 1;
00019     else _PWM = 0;
00020     
00021 }
00022 
00023 void TB6612FNG::Forward()
00024 {
00025     _IN1 = 1;
00026     _IN2 = 0;
00027 }
00028 
00029 void TB6612FNG::Stop()
00030 {
00031     _IN1 = 0;
00032     _IN2 = 0;
00033 }
00034 
00035 /*
00036 void TB6612FNG::Reverse(byte rpm);
00037 void TB6612FNG::Stop(byte rpm);
00038 void TB6612FNG::Brake(byte rpm);
00039 */
00040 
00041