Simple: interfacing a hobby motor with the Arduino


Newbie here. So, I don't have many components lying around. But I do have a few hobby motors. I was wondering how do I interface a hobby motor with the PWM on the Arduino board. For now, I would just like to play with sending different pulses to it. I don't really know where on the board to attach the black and red wire coming from the motor.

Also...I am not sure how to control it using software. I am pretty sure you would use analogWrite(). So could you please include sample code.

thank you sooo much


you can't just hook up the wires, you need a driver circuit... there are tutorial for doing this, try these links: