const int buttonPin = 3; // the number of the pushbutton pin const int ledPin1 = 0; // the number of the LED pin1 const int ledPin2 = 1; // the number of the LED pin2 const int ledPin3 = 6; // the number of the LED pin3 // 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 pin1 as an output: pinMode(ledPin1, OUTPUT); // initialize the LED pin2 as an output: pinMode(ledPin2, OUTPUT); // initialize the LED pin3 as an output: 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); } }