Controlling a DC motor for a certain amount of time

Thank you, i'll have a look at your code, and i'm interested in more suggestions.