Please use code tags!
This code part:
// only toggle the LED if the new button state is HIGH
if (buttonState == HIGH) {
ledState = !ledState;
}
currently toggles the LED. Now change that to not toggle the LED but simple store the time:
// only toggle the LED if the new button state is HIGH
if (buttonState == HIGH) {
lastButtonPush = millis();
pushCount++;
}
and later on, just above the "set the LED" comment:
if (pushCount && millis() - lastButtonPush > doubleClickTimeout) {
if (pushCount == 2) {
ledState = HIGH;
} else if (pushCount == 3) {
ledState = LOW;
}
pushCount = 0;
}
In the global variables part you need to include this code:
uint8_t pushCount = 0;
uint32_t lastButtonPush = 0;
uint32_t doubleClickTimeout = 200; // or whatever you find appropriate