Firstly, your debouncing function is incorrect. You can refer to the deboucing example.
I would like to recommend using this library to make it easier. Code for debouncing and detecting the event is very simple
#include <ezButton.h>
ezButton button(7); // create Button object that attach to pin 7;
bool showLights = true;
void setup() {
button.setDebounceTime(50); // set debounce time to 50 milliseconds
}
void loop() {
button.loop(); // MUST call the loop() function first
if(button.isPressed())
showLights = !showLights;
// add your code to control led here
}
Secondly, you are using delay() function. This will make Arduino miss some pressing events. I recommend to use timestamp instead, see BlinkWithoutDelay example