Problem with if/else

That's your void loop() function, above.

This code is in a place where it shouldn't be.