user54096: Program below is my program for my button and LED, but it's not functioning the way I want it too. The LED is supposed to light up before I press switch 9, but it is lighting up immediately. 
const int sw9=9;
const int sw10=10;
const int sw11=11;
const int sw12=12;
const int sw13=13;
int timer=250;
int s=0;
void setup()
{
  for (int opin=1;opin<=8;opin++)
{
  pinMode(opin,OUTPUT);
  pinMode(sw9,INPUT_PULLUP);
  pinMode(sw10,INPUT);
  pinMode(sw11,INPUT);
  pinMode(sw12,INPUT);
  pinMode(sw13,INPUT);
}
}
void loop(){
{ 
while (s==0)

for (int opin=1;opin<=8;opin++)
{
digitalWrite(opin,HIGH);
delay(timer);
digitalWrite(opin,LOW);
if(digitalRead(sw9)==LOW);
}

{
s=1;
delay(timer);
}
}
while(s==1)
for (int opin=1;opin<=8;opin++)
{
digitalWrite(opin,LOW);
if(digitalRead(sw9)==HIGH);
}
}


user42539: if(digitalRead(sw9)==LOW);

if(digitalRead(sw9)==HIGH);

Both of these have the effect of "read the switch and then do nothing"
Change them to
if(digitalRead(sw9)==HIGH){
// do intended action
}


54096: <p>Program below is my program for my button and LED, but it's not functioning the way I want it too. The LED is supposed to light up before I press switch 9, but it is lighting up immediately. </p>

<pre><code>const int sw9=9;
const int sw10=10;
const int sw11=11;
const int sw12=12;
const int sw13=13;
int timer=250;
int s=0;
void setup()
{
  for (int opin=1;opin&lt;=8;opin++)
{
  pinMode(opin,OUTPUT);
  pinMode(sw9,INPUT_PULLUP);
  pinMode(sw10,INPUT);
  pinMode(sw11,INPUT);
  pinMode(sw12,INPUT);
  pinMode(sw13,INPUT);
}
}
void loop(){
{ 
while (s==0)

for (int opin=1;opin&lt;=8;opin++)
{
digitalWrite(opin,HIGH);
delay(timer);
digitalWrite(opin,LOW);
if(digitalRead(sw9)==LOW);
}

{
s=1;
delay(timer);
}
}
while(s==1)
for (int opin=1;opin&lt;=8;opin++)
{
digitalWrite(opin,LOW);
if(digitalRead(sw9)==HIGH);
}
}
</code></pre>
 42539: <pre><code>if(digitalRead(sw9)==LOW);

if(digitalRead(sw9)==HIGH);
</code></pre>

<p>Both of these have the effect of "read the switch and then do nothing"</p>

<p>Change them to</p>

<pre><code>if(digitalRead(sw9)==HIGH){
// do intended action
}
</code></pre>
