//this file goes into the arduino software const int buttonPin = 2; // the number of the pushbutton pin const int ledPin1 = 13; // the number of the LED pin const int ledPin2 = 12; const int ledPin3 = 8; const int ledPin4 = 7; const int ledPin5 = 4; // variables will change: int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(ledPin3, OUTPUT); pinMode(ledPin4, OUTPUT); pinMode(ledPin5, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop(){ // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); int x = 100; // delay varaible int pin = 0; // intiate pin value that will be used in the loop // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: for(int i = 0; i <20; i++){ //for loop for all of leds for(int i=1; i<=5; i++){ //for loop that turns on and off each led if(i==5){ pin=4; } if(i==4){ pin=7; } if(i==3){ pin=8; } if(i==2){ pin=12; } if(i==1){ pin=13; } digitalWrite(pin, HIGH); delay(x); digitalWrite(pin, LOW); } } } else { // turn LED off: digitalWrite(ledPin1, LOW); digitalWrite(ledPin2, LOW); digitalWrite(ledPin3, LOW); digitalWrite(ledPin4, LOW); digitalWrite(ledPin5, LOW); } }