const int ledPin1 = 8;//pink LED const int ledPin2 = 7;//green LED 1 const int ledPin3 = 2;//green LED 2 const int buttonPin = 3;// button pin int buttonState = 0;//initial state of the button int i = 0; //variable intensity led void setup() { //declaration of inputs and outputs pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(ledPin3, OUTPUT); pinMode(buttonPin, INPUT); } void loop() { buttonState = digitalRead(buttonPin);// we read the state of the button if (buttonState == HIGH) { //if we press the button digitalWrite(ledPin1, HIGH); delay(2000); digitalWrite(ledPin2, HIGH); digitalWrite(ledPin3, HIGH); delay(2000); digitalWrite(ledPin2, LOW); digitalWrite(ledPin3, LOW); delay(2000); digitalWrite(ledPin1, LOW); delay(1000); } else { //if we don't press the button digitalWrite(ledPin1, LOW); digitalWrite(ledPin2, LOW); digitalWrite(ledPin3, LOW); } }