So I have followed this project. Here is an image of my setup, I only have one motor at the moment.
Get a real power source. That 9V battery is only good for smoke detectors.
Also, please post a schematic of how exactly you have it connected as there is an extra wire that concerns me.
Ok thanks for your reply,. What kind of power device do you think I should get?
Also, here are the schematics that I was following, except for the second motor. https://hackster.imgix.net/uploads/attachments/1160823/power_2_1_Rj5cILE90T.png?auto=compress%2Cformat&w=1280&h=960&fit=max.
Thanks for your help. I am a very beginner with Arduino coming from being a pretty good pc builder and trouble-shooter.
You need to draw a picture of exactly how you have it connected, because as I said, I believe you have an extra wire.
Can you recommend me a software or website that I can create and image similar to the one I sent before?
For now I recommend a pen and paper, maybe a ruler.
Ok thanks, ill send that asap
Just draw boxes for each item and clearly label the pins on either side of the wires.
Did you go by the drawing or by what you wired?
I count 10 wires in your picture and 9 wires in your drawing.
What motor is that?
Also, is your code identical to the tutorial or did you modify it for the single motor?
My code is identical to the tutorial. I have only ever coded for video games mechanics so I thought it would just ignore that motor and just power the one connected. Will that make a difference?
I also forgot to draw a wire. Here is the updated drawing ( Imgur: The magic of the Internet ).
I am not sure which motor it is, my teacher just sent this one to me. One the side of the motor body it says CL260-20100-40, if that helps.
Thanks for your help.
The last wire is wrong, the red one connected between the 5V pins. Get rid of it.
Currently your board is powered by the USB cable.
I do not know that motor and cannot find anything on it. You need to know the power requirements of the motor before you can continue properly.
Okay thanks, i'll ask my teacher.
The code says the Arduino output pins are 2, 3, 4, 5, your drawing says 1, 2, 3, 4.
Looks like it is 1,2,3,4 in the picture too.
One capable of enough current. Alkaline 9V batteries like that are good for a few 100mA at most, not the amps needed for a motor. Motors take lots of current, most beginners are surprized by this. The datasheet for the motor will explain its requirements (look under stall current for the maximum current pulled at start-up - its best if the motor driver and power source can handle this comfortably without dropping out).
For toy motors without datasheets you can measure the stall current or the winding resistance (which tells you the stall current for any voltage). Assume 1A or more for stall current of small low voltage motors (3V, 4.5V)
Remember the business part of a small motor is a few feet of copper wire - not much resistance in that, which is why stall current is high. When up to speed the back-EMF in the motor windings limits the idle current to much less, but at turn on there is no motion and no back-EMF so briefly it looks like a short piece of wire to whatever's powering it.