Pretty much I just wrote this to test it out, just switching the motors on back and forth, the problem is...
no matter what pin I assign each motor, only the first assigned motor (mtr1) works.
The other one doesn't do anything
( so if i assign mtr1 = 6 and mtr2 = 5, the motor attached to pin 6 will work and the other won't and vise versa.)
Well I have a 9v battery supply, the pins definately work, because if I use the code below, the one connected to the pin works and then when i connect it to the other transistor with the other motor, it works as well, just not in the same code together as in my first reply. ```
**int transistorPin = 6; // connected to the base of the transistor for one of the motors[/b]
Hi david, I wonder if it has something to do with the excess motor current or back EMF. Can you try it with LEDs instead of the motors. Or if you have multimeter, remove the motors and see if the pin voltages alternate every second. If everything works as expected without the motors then look closely at your motor drive circuit.
BTW, if the 9v battery is also powering the arduino through the regulator, check that the voltage isn't dropping below the regulator dropout threshold (probably 7v) when the motor switches on.
Based on the basic knowlege I now have on transistors, I made this circuit for controlling a motor to turn both ways, I'm sure this already exists, but could someone look at this one and tell me If it works or not and if so, what changes: