Motor control

Total newbie needs help with motor controlling.

I need to drive dc motor as following:

I have one limit switch.
Motor rotate clockwise 360 degrees, reach the switch and stops for x seconds.
Then rotate counterclockwise same 360 degrees, reach the switch and stops for y seconds.

Could someone give me an example how to do that?

Thanks!

You have not told us what type of motor you have or whether you have a motor driver board. You cannot connect a motor directly to an Arduino.

If you want someone to write a program for you please ask in the Gigs and Collaborations section of the Forum and be prepared to pay.

If you want to learn to program yourself the examples that come with the Arduino IDE are a good place to start. There are also many online tutorials. Also see the Useful Links Thread.

...R

Thanks for answering.

I use 12V DC motor with a self-made H-bridge.
HW is not a problem but I'm not familiar with SW.

I guess I could make it run with two switches but I have no idea how to do it with just one switch.

Post a diagram of your machine so we can understand how the limit switch is placed and how you propose to use the same switch for 2 directions (which is what I think you are trying to do).

...R

Especially, show us how the limit switch is activated by the motor mechanism. Is it pressed by an arm attached to the motor? Is it activated by a cam attached to the motor? Is it a standard micro switch? Or is a leaf switch that is pressed by something attached to the motor?

Paul