Hello,
I've got a circuit on a breadboard trying to drive 2 motors (independently of each other) with my Arduino and Sparkfun TB6612FNG motor driver.
Here's the circuit:
(Don't know if it matters but I'm not actually using an Arduino Uno...I'm using an Arduino Duemilanove)
Up until now, I've been just having 1 motor, and it's been working great. You'll see in the code that I have a 'timer' and what happens when it's triggered is fairly simple:
Beep the piezo speaker a few times
Turn LED 'A' on
Spin motor A for several seconds, then turn it off
Turn LED 'A' off
Again, it's worked great for 1 motor, but now that I've hooked up a second motor, and try to run it after the 1st motor (Motor A) runs, this is where I'm having the problem. What's happening is that the first motor never turns off it seems...it keeps going while the 2nd motor runs for it's few seconds...then they both turn off at the same time.
You'll see it in my Arduino file, but the updated 'pseudo' code would be this:
Beep the piezo speaker a few times
Turn LED 'A' on
Spin motor A for several seconds, then turn it off
Turn LED 'A' off
Turn LED 'B' on
Spin motor B for several seconds, then turn it off
Turn LED 'B' off
I keep looking at my code and don't see anything wrong, but I've obviously done something wrong.
I'm hoping someone will see something dumb in my code that I did wrong and point it out to me.
Here's a video of it in action:
It's kind of hard to see, but the 2nd motor does start up (you can hear it) just fine, but you'll also notice that the motor on the right (Motor A) never seems to stop (until the the 2nd motor stops anyway).
(I was going to post my code 'inline' with this post, but the forum said that I exceeded the maximum '9000' characters, so I had to attach the code instead)
Cat_Feeder_Cleaned_For_Forum_Post.pde (12.3 KB)