hi!!!
I would like to know how to conect a motor dc to the arduino for just to control de on and off, nothing else. I tryed with this schematic and this code but doesn't work,
I'm fairly new to the Arduino but I don't think pin13 is your best choice as I think it is hooked to other things on the board. As to the power, if you are using the USB for power you have a fairly low current you can draw for everything you are powering and run the risk of reseting the Arduino if the power is pulled too low. Someone else will know more and set both of us straight I'm sure.
thank you for your comments,
I've been investigating and both of you had reason.
pins 9,10,11 are analog output, or PWM, and the battery it was a bad idea, so I conected the motor to the diode in paralel, then the catode to the ground and the anode to the transistor base. the colector to the pin 10 and the emisor to 5v, and it works!!!!
(I think I explain with good words, I'm just a beginner.)