Millis timer

Hello there

What i am trying to complete is a timer that when a button is pushed it will start a timer from 2 min and go down to 0. At 0 it will make some noise, not done with that part. I want to light up 10 LEDs, only going 9 as of now. Whilst time is going down the leds should go down aswell. All this while using millis();

Keep in mind that as of right now i don't have an arduino with me and that i am quite new to this.
Also all i want is some tips, if there is anything to give. And if you see some fault in my code then please do tell. Thanks!

int buttonState = 0;
int PM1 = 0;
int buttonPin = 2; 
int leds [] = {3,4,5,6,7,8,9,10,11,12};
int MS = millis()/1000; 
int PreviousMillis = PM1; 
int m;
int timer = 120000; 
int first = 0; 


void setup() 

{
Serial.begin(9600); 

for (int leds; leds<=12;leds++)
{
  pinMode(leds, OUTPUT);
}
  pinMode(buttonPin, INPUT_PULLUP); 
}





void loop() 
{
  if(first ==1)
  {
    first = 0;
    timer--; 
    if(timer <= 0)
    {
      timer = 0;
    }
  }



if (buttonState == 1)


  {

  int CM = millis(); 
  if (CM-PM1 <=0)
    {
    PM1 = CM;
    timer = timer - 1;
  if(timer <= 0)
      {
    timer = 120000;
    
      }

    digitalWrite(leds, HIGH);
  if(timer == 0)
      {
    digitalWrite(leds, LOW); 
      }
  else
      {
    digitalWrite((leds-1), LOW); 
      }
    }
  }
}

Have a look at Using millis() for timing. A beginners guide

And Several Things at a Time illustrates its usage.

By the way, this line in your code is not appropriate - at least not where it is.

int MS = millis()/1000;

If you want a variable that shows the value of seconds it has to be continually updated in the loop() function.

And generally speaking all variables associated with millis() should be defined as unsigned long.

...R

for (int leds; leds<=12;leds++)

Lots of things wrong here.

You don't initialise "leds" to zero, you already have an array called "leds", and you don't have thirteen elements in the array "leds", which you don't refer to as an array in the call to pinMode.

Even if you don't have a board, you can at least try to compile code. The compiler won't catch all of your problems, so beware.