const int buttonPin = 0; // the number of the pushbutton pin const int ledPin1 = 1; // the number of the LED pin const int ledPin2 = 2; // the number of the LED pin const int ledPin3 = 3; // the number of the LED pin // variables will change: int buttonState = 0; // variable for reading the pushbutton status int buttonCount = 0; // int delay_interval = 0; void setup() { Serial.begin(115200); // initialize the LED pin as an output: pinMode(ledPin1, OUTPUT); // initialize the pushbutton pin as an input: pinMode(ledPin2, OUTPUT); // initialize the pushbutton pin as an input: pinMode(ledPin3, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT_PULLUP); } void loop() { // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); Serial.print("buttonState: "); Serial.println(buttonState); Serial.print("buttonCount: "); Serial.println(buttonCount); if (buttonState == LOW) { buttonCount+= 1; delay(3000); if (buttonCount > 3) { buttonCount = 0; } } if (buttonCount == 0) { digitalWrite(ledPin1, LOW); digitalWrite(ledPin2, LOW); digitalWrite(ledPin3, LOW); } else if (buttonCount == 1) { digitalWrite(ledPin1, HIGH); delay(100); digitalWrite(ledPin1, LOW); delay(100); } else if (buttonCount == 2) { digitalWrite(ledPin2, HIGH); delay(500); digitalWrite(ledPin2, LOW); delay(500); } else if (buttonCount == 3) { digitalWrite(ledPin3, HIGH); } }