DC Motor not moving with TB6612FNG motor driver

Hello, I am extremely new to Arduino; this is the first time I am using one. I am using the Uno R3. I want to control the speed of a DC motor through the arduino, but it is not working for some reason. I am using the TB6612FNG motor driver from Pololu. Here is its pinout.
pinout
My circuit looks like this, with the red motor driver in the middle being the TB6612FNG:


I am using a 9 volt battery.

Here is my code:

#define PWMA 11
#define AIN1 13
#define AIN2 12
#define STBY 4

void setup() {
  pinMode(PWMA, OUTPUT);
  pinMode(AIN1, OUTPUT);
  pinMode(AIN2, OUTPUT);
  pinMode(STBY, OUTPUT);

}

void loop() {
  digitalWrite(STBY, HIGH);
  digitalWrite(AIN1, HIGH);
  digitalWrite(AIN2, LOW);
  analogWrite(PWMA, 255);
}

Can someone please help me out?

Yes. What is your question?

This is not a question.

I wrote some TB6612FNG motor code that I have in this link. It shows how to use "direction" and "pwm" with each motor. Search the page for "motors"

This type of battery is not recommended for driving an motor.

Is your motor a 9V motor?
Where does the Uno get it's power?

What type of battery should I use then? Do I need another battery for the logic power?

See post #4

The current motor is a 3V motor, you are right.

I switched to one rated for "1.5-12V", and tested the circuit again, but it is still not working.

I believe that the Uno gets its power from the external 9V battery, but I am not sure. Can you please help me?

Not according to your wiring diagram. Connect the Uno to your computer and try again

I am unsure what you mean by connecting the Uno to my computer. I used an AB USB cable to connect the USB connector on the arduino to a USB port on my laptop, and then uploaded the sketch.

According to your diagram the Uno has NO power. Connect it to your computer in order to supply power to the UNO, otherwise it will not work.

I connected an AB USB cable to the USB connector on the Arduino(gray metal thing just below reset button on the arduino in the diagram) and attached the other end of the cable to my laptop. I ran the sketch by pressing the upload button, but the motor is still not working. I know the battery has power and the motor works because I tested them using only the battery, the motor, and two wires.

Disregard this.

If your drawing matches you connections and both are correct, this disables the motor.

Did you do a good job of soldering the headers on to the TB6612 board?
Can you show some pictures of your set-up?

I did not solder the headers onto the TB6612FNG. I just placed the circuit on the headers.
Here is a picture of my setup:

That is your problem.
They must be soldered!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.