What do you mean by 'stops working' ?
What do you see if you print the value of e just after the test of the value of v1 inside the for loop, and before the if after the for loop ?
Note that e will always be 1 if the 16th reading of v1 is zero no matter what the previous 15 readings were. Is that what you intended ?