DC motor with 3(or more) programmed limits

Brinarpi:
I was tested before I publish believe to me.

It was count properly, and the PWM was also working.

You need to tell us that sort of thing.

Any idea for continue?

I gave you ideas in Reply #15

The next thing on my list is to get the motor to stop at a particular position.

You won't be able to do that using delay() like you have in the code in Reply #22. If you do need to manage timing you will have to use millis() for non-blocking timing as illustrated in Several Things at a Time. That will allow you to read the encoder anytime you need to.

However, to start with I would not bother with the 2nd and 3rd pieces in your loop() code. Just get the motor working in one direction and try to stop it after a specific encoder count. It will be easier if the motor is running slowly.

...R