Can you explain a bit more about what you are trying to do? I presume you mean a DC motor and you are looking to turn it X degrees (90, 180) etc. If so, why are you using a DC motor instead of a servo? DC motors are not really intended to reliably move a certian numebr of degrees.
If you are using a DC Motor, you could get some pretty good results using an attached encoder. There's an encoder tutorial here:
Otherwise, I agree with Eddie that a servo would work better in this case as servos are designed to move to precise positions. A stepper motor might serve well too. You could figure out how many steps it took to move 30 degrees and hard-code that number.