What you can do to make it simplier is to send a PWM ( pulse width module ) to an analogOutput so it can control the speed rate of a switch. Then the switch could to turn the motor on and off
The circuit should be something like the figure attached.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16