The speed of the Lego motor can be adjusted from 0 to 100 percent. Simply varying the voltage to the motor does not work because there is a minimum voltage for the motor to start up, and an associated minimum speed. The solution is to use pulse width modulation.
http://members.home.nl/b.vandam/lonely/pagina20.html