echigard:
I need to count only the amount of time the motor is ON until it reach 12 minutes despite the time it was stop.
That sort of thing is often a problem of thinking clearly rather than of writing code. Keep in mind that the computer is very stupid so you have to be its brains.
...R