You are on page 1of 5

const int button1Pin =7; //establishing pin values

const int ledPin = 13; //estblishing pin values

void setup()
{
pinMode(13,OUTPUT); //getting ready to send electricity through pin 13
pinMode(12,OUTPUT); //getting ready to send electricity through pin 12
pinMode(11,OUTPUT); //getting ready to send electricity through pin 11
pinMode(10,OUTPUT); //getting ready to send electricity through pin 10
pinMode(9,OUTPUT); //getting ready to send electricity through pin 9
pinMode(8,OUTPUT); //getting ready to send electricity through pin 8
pinMode(button1Pin,INPUT); //getting ready to send electricity through pin 7

void loop()
{
int button1State;
button1State=digitalRead(button1Pin); //turn on button
digitalWrite(13, HIGH); //pin 13 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(13, LOW); //pin 13 turn off
digitalWrite(12, HIGH); //pin 12 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(12, LOW); //pin 12 turn off
digitalWrite(11, HIGH); //pin 11 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(11, LOW); //pin 11 turn off
digitalWrite(10, HIGH); //pin 10 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(10, LOW); //pin 10 turn off
digitalWrite(9, HIGH); //pin 9 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(9, LOW); //pin 9 turn off
digitalWrite(8, HIGH); //pin 8 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(8, LOW); //pin
if (button1State == LOW) //if button is being pushedc following code happens
{{digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(100);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
delay(100);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
delay(100);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
delay(100);
digitalWrite(9, LOW);
digitalWrite(8, HIGH);
delay(100);
digitalWrite(8, LOW);
}}

else //if b utton isnt being pushed light turns off


{
digitalWrite(13, LOW); //turn of pin 13
digitalWrite(12, LOW); //turn off pin 12
digitalWrite(11, LOW); //turn off pin 118
digitalWrite(10, LOW); //turn off pin 10
digitalWrite(9, LOW); //turn off pin 9
digitalWrite(8, LOW); //turn off pin
delay
(999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999
9);
}
if (button1State == LOW)
{digitalWrite(13, HIGH);
delay(75);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(75);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
delay(75);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
delay(75);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
delay(75);
digitalWrite(9, LOW);
digitalWrite(8, HIGH);
delay(75);
digitalWrite(8, LOW);
}

else
{
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
delay (999999999999999999999999999);
}}

You might also like