need help, Dc motor control using single switch

i'm new user in arduino and i have low experience in programming, so i need help
i want to control Dc motor using single switch
when i press first time, motor turns clockwise
when i press again, motor stops
when i press third time, motor turns anti clockwise
when i press again, motor stops and so on.
Thanks in advance

Well that can be pretty easily accomplished with an arduino. For minimum hardware you need any arduino board, a push-button momentary switch, and a motor H-drive controller and power source rated to run the motor in question. The rest is fairly simple sketch software commands.

If you don't require variable speed control for the motor (just full speed forward or reverse, or stopped) then it is possible to replace the H-drive controller with a DPDT relay and a couple of switching transistors, if your switching frequency is not too high. One transistor controls the relay for direction control, and the other transistor switches power on and off for the motor circuit.

Lefty

Welcome!

I see Lefty beat me to it... As he says, an H-bridge is the simplest way to go, especially for a new programmer (I assume you are also new at electronics, too).

Google H-bridges and see how to connect them to motors and to see how to use a switch. They both should be fairly easy to understand.

Look online for the parts.

thanks alot for your help :slight_smile: