capacity sensors and servo motors

You keep having the line

timer = 15;

What do you think it is doing?
It is not doing anything useful it is just putting the value of 15 in the variable timer.
If you want 15 in this variable you only have to do it once.