set motor speed dynamically