I'm trying to wire and control TB6612FNG Dual Motor Driver Carrier, but am doing something wrong. Why is the motor not running?
I have the vcc and gnd connected to a 5v power source, and ao1 and ao2 connected to my motor.
When connecting the power source directly to the motor, the motor runs.
pwma, ain1, ain2, and stby pins are connected the pins as expected from the sketch. I also have the gnd pin on the logic side of the board connected to a gnd pin on the arduino(uno v2). PWMA is connected to pin 5, which is a digital pin.
const int stby=2;
const int in1=3;
const int in2=4;
const int pwm=5;
void setup() {
// put your setup code here, to run once:
pinMode(stby, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(pwm, OUTPUT);
forward(255);
}
void loop() {
}
void forward(int speed)
{
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(stby, HIGH);
analogWrite(pwm, speed);
}