First code to control motor speed.