Need help to simplify

Thank you for the help!!

I have it working the way I want it to work.

What was wrong was, I used an integer to hold the value for the delay time. An integer yields a range of -32,768 to 32,767. I wanted the time delay to vary from 30 seconds as the minimum to a maximum 3 minutes. In milliseconds this would be 30000 to 180000, which wouldn't fit in the integer.

Thank you ballscrewbob for the help.

See the final code below

int redLight = 13;
int yellowLight = 12;
int greenLight = 11;
int val = 0;
unsigned long rest;

void setup()
{
pinMode(redLight, OUTPUT);
pinMode(yellowLight, OUTPUT);
pinMode(greenLight, OUTPUT);
digitalWrite(redLight,LOW);
digitalWrite(yellowLight,HIGH);
digitalWrite(greenLight,HIGH);
}

void loop(){

  val = analogRead(A0);
  rest = map(val, 0, 1023, 30000, 180000);
  delay(100); 
  digitalWrite(redLight,HIGH);
  delay(rest);
  digitalWrite(redLight,LOW);
  
  digitalWrite(greenLight,LOW);
  delay(rest);
  digitalWrite(greenLight,HIGH);
   
  digitalWrite(yellowLight,LOW);
  delay(3000);
  digitalWrite(yellowLight,HIGH);
       }