- Scale the input (and protect the Arduino from overvolrtage spiukes etc)
- Use analogRead() to sense the input voltage.
- Perform your logic as needed.
- USe the PWM analogWrite() function to creaste the drive pulse train...
You WILL need a power amplifier of some sort to source/sink enough current for the motor itself.
This could be a single transistor for small battery operated motors, through to a major investment for high powered motors.
PWM does not put out a varying voltage - it generates a variable duty-cycle pulse train that can be used to synthesise an analog voltage - or in the specific case of DC motors the digital pulse train has advantages for increased low-end torque / anti-stalling of the motor.