making a dc motor rotate X number of times

hi, i'm new to arduino forums (and kinda new to arduino programming as well)

i have a number pad, an arduino uno board, and a dc motor. i need to make this dc motor turn as many times as inputted in the number pad. what program might be suitable for this goal?

Before you think about programming it, you need to have a way of knowing where the motor is, rotationally speaking. You would have to have an encoder of some kind, so you can count the "steps" and know how far it's gone.

But then the programming will not be simple, since you will need to start stopping it before it gets to where you want, else it will over-shoot.

I think you will be better off with a stepper motor.

As mentioned, encoders are made for this. But, if extreme resolution isn't needed, a simple flag on the motor shaft which blocks a photo interrupter or a hall switch sensing a shaft-mounted magnet would get you there. Although these won't give direction, like a quadrature encoder will, the code involved is just a counter.

i think i'll just get a stepper. still struggling with the keypad library, though. it doesn't seem to be includable