/*  start  scelta   funzione

 *    0      0        nop

 *    0      1        nop

 *    1      0         prima striscia

 *    1      1        seconda sriscia

 *    striscia1 dal pin5 led1 al pin9 led4, seconda striscia dal pin10 led5 al pin12 led8

 *

 */

 

//dichiarazione delle variabili

 

int led[]={2,3,4,5,6,7,8,9,10,11,12,13};

const int start=0;

const int scelta=1;

int start_stato=0;

int scelta_stato=0;

int caso=0;

int ana0=0;

int ritardo=1;

int i=0;

void setup() {

  // put your setup code here, to run once:

     for(i=0;i<12;i++)

         {

          pinMode(led[i],OUTPUT);

         }

     pinMode(start,INPUT);

     pinMode(scelta,INPUT);

    

}

 

  

void loop() {

  // put your main code here, to run repeatedly:

 

   

     start_stato=digitalRead(start);

       scelta_stato=digitalRead(scelta);

       ana0=analogRead(0);

       ritardo=ritardo+ana0/10;

        if(start_stato==0 && scelta_stato==0){caso=0;}

        if(start_stato==0 && scelta_stato==1){caso=0;}

        if(start_stato==1 && scelta_stato==0){caso=1;}

        if(start_stato==1 && scelta_stato==1){caso=2;}

 

         switch(caso)

         {

          case 0:

           { 

            //no operation

            

           }

           

          break;

          case 1:

               {

                   //effetto super car prima stringa di led da led1 a led4

                  for(i=0;i<5;i++)

                  {

                   digitalWrite(led[i],HIGH); delay(ritardo);digitalWrite(led[i],LOW); delay(ritardo);

                  }

                 

                for(i=5;i>-1;i--)

                {

                  digitalWrite(led[i],HIGH); delay(ritardo);digitalWrite(led[i],LOW); delay(ritardo);

               

               }

          break;

        case 2:

               {

                  //effetto super car seconda stringa di led

                 

                      for(i=6;i<12;i++)

                  {

                   digitalWrite(led[i],HIGH); delay(ritardo);digitalWrite(led[i],LOW); delay(ritardo);

                  }

                 

                for(i=11;i>5;i--)

                {

                  digitalWrite(led[i],HIGH); delay(ritardo);digitalWrite(led[i],LOW); delay(ritardo);

               

 

               }

                                    break;

                 

         }

         ritardo=1;

 

 

}