DC motor with 3(or more) programmed limits

Ok Robin.

I am not afraid to start from a begining, but I am not skilled enough to do it from myself. If You help to me in steps(as you post) I am ready to start with step by step.

If You remember my project before(wich is ready thaks to You) I learn a lot of things, but this is something else(other area with PWM, accel/decel, encoder etc.

Your simple sketch is the base. If I come on something with that I will post it.

First thing:

"Get the motor speed control working based on values in program variables (no user data entry)."

I dont understand exacly what do you mean with program variables?