4 flashing leds

hi I am new to the arduino i was using a picaxe but the c++ code is not the same so i thought i would start with making some led lights flash . i have a arduino running a solid state relay board .i also have 2 pots so i can change the speed of the lights one pot is for how long the light is on and one for how long it is of. and there is a 6 position rotary switch to set the lights to flash different displays. i allso have a push button this button is so when you push it you get 12 different displays but i cant get this to work what i was trying to do is if the push button is in (high) and the rotary switch is at position 1 do display 7 and so on to 12
can you help here is my code

//disco lights 


int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int pota = 0; 
int potb = 1;    
int point1 = 2; 
int point2 = 3; 
int point3 = 4; 
int point4 = 5; 
int point5 = 6; 
int point6 = 7; 
int pattern1 = 0;
int pattern2 = 0; 
int pattern3 = 0; 
int pattern4 = 0; 
int pattern5 = 0; 
int pattern6 = 0; 


void setup() {                

  pinMode(led1, OUTPUT);   
  pinMode(led2, OUTPUT);   
  pinMode(led3, OUTPUT);  
  pinMode(led4, OUTPUT); 
  pinMode(point1, INPUT_PULLUP); 
  pinMode(point2, INPUT_PULLUP); 
  pinMode(point3, INPUT_PULLUP); 
  pinMode(point4, INPUT_PULLUP); 
  pinMode(point5, INPUT_PULLUP);
  pinMode(point6, INPUT_PULLUP);

}   
void loop() {               
  // read the state of the pushbutton value:
  pattern1 = digitalRead(point1);     
  pattern2 = digitalRead(point2);
  pattern3 = digitalRead(point3);
  pattern4 = digitalRead(point4);
  pattern5 = digitalRead(point5);
  pattern6 = digitalRead(point6);

  pota = analogRead(0);    
  potb = analogRead(1);     

  if (pattern1 == LOW) { 
    digitalWrite(led1, HIGH); 
    delay(pota+10);                
    digitalWrite(led2, HIGH);   
    delay(pota+100);              
    digitalWrite(led3, HIGH);   
    delay(pota+10);                 
    digitalWrite(led4, HIGH);   
    delay(pota+10);             
    digitalWrite(led1, LOW);    
    delay(potb+10);            
    digitalWrite(led2, LOW);  
    delay(potb+10);               
    digitalWrite(led3, LOW);    
    delay(potb+10);                
    digitalWrite(led4, LOW);               

  }

  if (pattern2 == LOW){
    digitalWrite(led2, HIGH); 
    delay(pota+10);                 
    digitalWrite(led3, HIGH);  
    delay(pota+10);                
    digitalWrite(led1, HIGH);   
    delay(pota+10);                 
    digitalWrite(led4, HIGH);   
    delay(pota+10);                
    digitalWrite(led2, LOW);     
    delay(potb+10);               
    digitalWrite(led3, LOW);    
    delay(potb+10);                
    digitalWrite(led1, LOW);    
    delay(potb+10);                
    digitalWrite(led4, LOW);    

  }

  if (pattern3 == LOW) {
    digitalWrite(led1, HIGH); 
    delay(pota+10);                 
    digitalWrite(led2, HIGH);   
    delay(pota+10);                
    digitalWrite(led3, HIGH);   
    delay(pota+10);                 
    digitalWrite(led4, HIGH);  
    delay(pota+10);                
    digitalWrite(led1, LOW);     
    delay(potb+10);               
    digitalWrite(led2, LOW);    
    delay(potb+10);                
    digitalWrite(led3, LOW);    
    delay(potb+10);                
    digitalWrite(led4, LOW);    
    delay(potb+10);         
    digitalWrite(led4, HIGH);
    delay(pota+10);
    digitalWrite(led3, HIGH);
    delay(pota+10);
    digitalWrite(led2, HIGH);
    delay(pota+100);
    digitalWrite(led1, HIGH);
    delay(pota+10);
    digitalWrite(led4, LOW);
    delay(potb+10);
    digitalWrite(led3, LOW);
    delay(potb+10);
    digitalWrite(led2, LOW);
    delay(potb+10);
    digitalWrite(led1, LOW);


  }

  if (pattern4 == LOW){
    digitalWrite(led1, HIGH); 
    digitalWrite(led2, HIGH);   
    delay(pota+100);                
    digitalWrite(led3, HIGH);   
    digitalWrite(led4, HIGH);   
    delay(pota+100);               
    digitalWrite(led1, LOW);    
    digitalWrite(led2, LOW);   
    delay(potb+100);                
    digitalWrite(led3, LOW);   
    digitalWrite(led4, LOW);    

  }

  if (pattern5 == LOW) {
    digitalWrite(led1, HIGH);                
    digitalWrite(led2, HIGH);                   
    digitalWrite(led3, HIGH);                   
    digitalWrite(led4, HIGH);  
    delay(pota+10);                
    digitalWrite(led1, LOW);     
    delay(potb+10);               
    digitalWrite(led1, HIGH); 
    delay(pota+10);
    digitalWrite(led2, LOW);
    delay(potb+10);
    digitalWrite(led2, HIGH);    
    delay(pota+10);                
    digitalWrite(led3, LOW);    
    delay(potb+10);         
    digitalWrite(led3, HIGH);
    delay(pota+10);
    digitalWrite(led4, LOW);
    delay(potb+10);             
    digitalWrite(led4, HIGH); 
    delay(pota+10);
    digitalWrite(led3, LOW);
    delay(potb+10);
    digitalWrite(led3, HIGH);    
    delay(pota+10);                
    digitalWrite(led2, LOW);    
    delay(potb+10);         
    digitalWrite(led2, HIGH);
    delay(pota+10);
    digitalWrite(led1, LOW);


  }
  if (pattern6 == LOW){
    digitalWrite(led1, HIGH); 
    delay(pota+10); 
    digitalWrite(led1, LOW);   
    delay(potb+10);                
    digitalWrite(led2, HIGH); 
    delay(pota+10);   
    digitalWrite(led2, LOW);   
    delay(potb+10);               
    digitalWrite(led3, HIGH);  
    delay(pota+10);   
    digitalWrite(led3, LOW);   
    delay(potb+10);                
    digitalWrite(led4, HIGH);  
    delay(pota+10);  
    digitalWrite(led4, LOW);    
    delay(potb+10); 
    digitalWrite(led3, HIGH); 
    delay(pota+10); 
    digitalWrite(led3, LOW);   
    delay(potb+10);                
    digitalWrite(led2, HIGH); 
    delay(pota+10);   
    digitalWrite(led2, LOW);   
    delay(potb+10);               
    digitalWrite(led1, HIGH);  
    delay(pota+10);   
    digitalWrite(led1, LOW);   
  }


}

thanks paul

  // read the state of the pushbutton value:

Where? You have code to read the encoder and the pots, but nothing to read the pushbutton.

You should look into arrays to help cut down that code, and the Blink Without Delay example to allow your LEDs to be more responsive to the input.

Doing multiple things at once: Gammon Forum : Electronics : Microprocessors : How to do multiple things at once ... like cook bacon and eggs

Reading switches: Gammon Forum : Electronics : Microprocessors : Switches tutorial

big thanks Arrch for the help i have not written any code yet for the button because every time i try it dose not work. you have given me a good advice i will look into arrays

Arrch: arrays to help cut down that code, and the Blink Without Delay example to allow your LEDs to be more responsive to the input.

thanks Nick that sounds like what i need to do i will look up [quote author=Nick Gammon link=topic=152279.msg1143161#msg1143161 date=1362458318] Doing multiple things at once: http://www.gammon.com.au/blink

Reading switches: http://www.gammon.com.au/switches

[/quote] thanks for the help this has given some thing i need to look at

hi I was told that if I did this it would work pattern7 to work if (pattern7 == LOW && pattern1 == LOW) so looked up this http://arduino.cc/en/Reference/Boolean but this did not work it runs both patterns 7 then patter 1. my code needs some work to read better pattern 7 is the push button on input pin 8 and pattern 1 is a input on pin 2 from the 6 position switch

//disco lights 


int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int pota = 0; 
int potb = 1;    
int pin2 = 2; 
int pin3 = 3; 
int pin4 = 4; 
int pin5 = 5; 
int pin6 = 6; 
int pin7 = 7; 
int pin8 = 8;
int pattern1 = 0;
int pattern2 = 0; 
int pattern3 = 0; 
int pattern4 = 0; 
int pattern5 = 0; 
int pattern6 = 0; 
int pattern7 = 0; 


void setup() {                

  pinMode(led1, OUTPUT);   // initialize the digital pin as an output.
  pinMode(led2, OUTPUT);   // Note: Analogue pins are
  pinMode(led3, OUTPUT);  // automatically set as inputs
  pinMode(led4, OUTPUT); 
  pinMode(pin2, INPUT_PULLUP); 
  pinMode(pin3, INPUT_PULLUP); 
  pinMode(pin4, INPUT_PULLUP); 
  pinMode(pin5, INPUT_PULLUP); 
  pinMode(pin6, INPUT_PULLUP);
  pinMode(pin7, INPUT_PULLUP);
  pinMode(pin8, INPUT_PULLUP);

}   
void loop() {               
  

  pattern1 = digitalRead(pin2);     
  pattern2 = digitalRead(pin3);
  pattern3 = digitalRead(pin4);
  pattern4 = digitalRead(pin5);
  pattern5 = digitalRead(pin6);
  pattern6 = digitalRead(pin7);
  pattern7 = digitalRead(pin8);

  pota = analogRead(0);    
  potb = analogRead(1);    

  if (pattern1 == LOW ) { 
    digitalWrite(led1, HIGH); 
    delay(pota+10);                
    digitalWrite(led2, HIGH);   
    delay(pota+100);              
    digitalWrite(led3, HIGH);   
    delay(pota+10);                 
    digitalWrite(led4, HIGH);   
    delay(pota+10);             
    digitalWrite(led1, LOW);    
    delay(potb+10);            
    digitalWrite(led2, LOW);  
    delay(potb+10);               
    digitalWrite(led3, LOW);    
    delay(potb+10);                
    digitalWrite(led4, LOW);               

  }

  if (pattern2 == LOW){
    digitalWrite(led2, HIGH); 
    delay(pota+10);                 
    digitalWrite(led3, HIGH);  
    delay(pota+10);                
    digitalWrite(led1, HIGH);   
    delay(pota+10);                 
    digitalWrite(led4, HIGH);   
    delay(pota+10);                
    digitalWrite(led2, LOW);     
    delay(potb+10);               
    digitalWrite(led3, LOW);    
    delay(potb+10);                
    digitalWrite(led1, LOW);    
    delay(potb+10);                
    digitalWrite(led4, LOW);    

  }

  if (pattern3 == LOW) {
    digitalWrite(led1, HIGH); 
    delay(pota+10);                 
    digitalWrite(led2, HIGH);   
    delay(pota+10);                
    digitalWrite(led3, HIGH);   
    delay(pota+10);                 
    digitalWrite(led4, HIGH);  
    delay(pota+10);                
    digitalWrite(led1, LOW);     
    delay(potb+10);               
    digitalWrite(led2, LOW);    
    delay(potb+10);                
    digitalWrite(led3, LOW);    
    delay(potb+10);                
    digitalWrite(led4, LOW);    
    delay(potb+10);         
    digitalWrite(led4, HIGH);
    delay(pota+10);
    digitalWrite(led3, HIGH);
    delay(pota+10);
    digitalWrite(led2, HIGH);
    delay(pota+100);
    digitalWrite(led1, HIGH);
    delay(pota+10);
    digitalWrite(led4, LOW);
    delay(potb+10);
    digitalWrite(led3, LOW);
    delay(potb+10);
    digitalWrite(led2, LOW);
    delay(potb+10);
    digitalWrite(led1, LOW);


  }

  if (pattern4 == LOW){
    digitalWrite(led1, HIGH); 
    digitalWrite(led2, HIGH);   
    delay(pota+100);                
    digitalWrite(led3, HIGH);   
    digitalWrite(led4, HIGH);   
    delay(pota+100);               
    digitalWrite(led1, LOW);    
    digitalWrite(led2, LOW);   
    delay(potb+100);                
    digitalWrite(led3, LOW);   
    digitalWrite(led4, LOW);    

  }

  if (pattern5 == LOW) {
    digitalWrite(led1, HIGH);                
    digitalWrite(led2, HIGH);                   
    digitalWrite(led3, HIGH);                   
    digitalWrite(led4, HIGH);  
    delay(pota+10);                
    digitalWrite(led1, LOW);     
    delay(potb+10);               
    digitalWrite(led1, HIGH); 
    delay(pota+10);
    digitalWrite(led2, LOW);
    delay(potb+10);
    digitalWrite(led2, HIGH);    
    delay(pota+10);                
    digitalWrite(led3, LOW);    
    delay(potb+10);         
    digitalWrite(led3, HIGH);
    delay(pota+10);
    digitalWrite(led4, LOW);
    delay(potb+10);             
    digitalWrite(led4, HIGH); 
    delay(pota+10);
    digitalWrite(led3, LOW);
    delay(potb+10);
    digitalWrite(led3, HIGH);    
    delay(pota+10);                
    digitalWrite(led2, LOW);    
    delay(potb+10);         
    digitalWrite(led2, HIGH);
    delay(pota+10);
    digitalWrite(led1, LOW);


  }
  if (pattern6 == LOW){
    digitalWrite(led1, HIGH); 
    delay(pota+10); 
    digitalWrite(led1, LOW);   
    delay(potb+10);                
    digitalWrite(led2, HIGH); 
    delay(pota+10);   
    digitalWrite(led2, LOW);   
    delay(potb+10);               
    digitalWrite(led3, HIGH);  
    delay(pota+10);   
    digitalWrite(led3, LOW);   
    delay(potb+10);                
    digitalWrite(led4, HIGH);  
    delay(pota+10);  
    digitalWrite(led4, LOW);    
    delay(potb+10); 
    digitalWrite(led3, HIGH); 
    delay(pota+10); 
    digitalWrite(led3, LOW);   
    delay(potb+10);                
    digitalWrite(led2, HIGH); 
    delay(pota+10);   
    digitalWrite(led2, LOW);   
    delay(potb+10);               
    digitalWrite(led1, HIGH);  
    delay(pota+10);   
    digitalWrite(led1, LOW);   
  }



  if (pattern7 == LOW &&  pattern1 == LOW){                                     // this is the part that dose not work :
    digitalWrite(led1, HIGH);
    delay(pota+100);
    digitalWrite(led1, LOW);
  delay(pota+100);
  }
  }

i have fixed the problem with and the button pattern7 i did need to add if (pattern7 == LOW && pattern1 == LOW) but i also i had to add pattern7 == HIGH && on pattern1 to stop it from running if (pattern7 == HIGH && pattern1 == LOW) all need to do now is tidy up the code BIG THANKS FOR ALL THE HELP