Running a DC motor with PWM

Thank you everybody for the replies. I have been hard at it for alot of things. I have found the program that will work and once I get it all tested and working I will share it. Then I will start working on the Program for the mega that is going to control all the sensors and lights for the track. Its going to be the best train set a kid could ever ask for. Thank you again to all. Everything has helped me get to this point with alot of learning.