Ni. I mean that in your code you check that the button is pushed (or the lines touch), and that it was not pushed before (or that the lines were not touching before).
if (buttonState != lastButtonState) {
lastDebounceTime = millis();
// if the state has changed, increment the counter
if (buttonState == HIGH) {
That's line 1 and line 2 of the steps that I think you are trying to implement. (Now that I think about it, I think you are doing these backwards, too.)
Then, you increment the touch count:
buttonPushCounter++;
That's line 4.
Finally, you look at how long it has been since the wires last touched:
if ((millis() - lastDebounceTime) > debounceDelay)
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;
For debouncing, you would see if the wires touched, when they didn't before, and that the time since they last touched was greater than some threshold. The idea is that two touches within 5 milliseconds only counts as one touch.
When you set the contact time, and the action that you take if the time is high enough, are both wrong.
The code should see if the wires are touching (HIGH). Then, it should see if that represents a change in state (not equal to previous state). If both of these conditions are true, then it should check the length of time elapsed since the last change in state (to HIGH). If sufficient time has elapsed, then increment the counter and set a new contact time.
Finally, regardless of whether the wires are now in contact, or not, set the previous state to the current state. Looks something like this:
void loop()
{
int currentButtonState = digitalRead(buttonPin);
if(currentButtonState == HIGH &&
currentButtonState != previousButtonState)
{
// Contact was just made. See if it's been long enough...
if(millis() - previousContactTime > threshold)
{
// This counts as a new contact
buttonPush++; // Light up another LED, too
previousContactTime = millis(); // Set a new contact time
}
}
previousButtonState = currentButtonState;
// Now, see if the game is over. User could have reached end, or could
// have touched too many times. Do whatever is required to start a new
// game, including setting previousContactTime to 0 and
// previousButtonState to LOW.
}