Your choice but it makes you look like a rank beginner.
some recommendations:use switch case instead of if if ifuse transistors and diodescontrol the current in a binary way wit R1 = 50 ohm; r2 = 100 ohm; r3 = 200 ohm etc.or better, use PWM.Use a H-bridge to control the motor in both directions
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