How to make software voltage divider?

I believe a DC motor control board will do exactly what you need.

If that does not suit your purposes, then you will need to supply more details on how many voltages you want to supply to the motor.