problem with receive SMS

I think I understand how it works, but do not understand how can make it work

You haven't got the idea yet.
Reas reply #11 again.
Yes you are detecting a state cha be but you are not using millis to make a note of the time when each transition occours. That fist part of the loop containing millis is not doing anything for you.

if the black lane of the disk stop on the LED doesnt stop the counting and something last the biggest value is 29 /sec this mean delay ?

First you mentioned of this. That will make the "what to do with this pulse number" part of the code a bit more complex but not much. Just decide on a value that if it exceeds you consider it stopped.