Thanks for your answer.
The sketch is working perfect, but in the wrong direction.
I've tried it why my hardware and as long as i hold my hand over the sensor at a certain distance, the interval remains the same.
When i move my hand (nearer or farther), the interval changes. So my ears are fine.
Greetings.