Forget the post above. I think I solved my problem. Since I couldnt get the delay to go above 30s I tried running the delay 6 times in a row. Well, it worked! Its not the most elegant way and definitely not the correct way but it works.
int sensorPin = A5; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
}
void loop() {
int val = analogRead(5);
val = map(val, 0, 1023, 0, 30000);
// read the value from the sensor:
digitalWrite(ledPin, HIGH);
// stop the program for <sensorValue> milliseconds:
delay(val);
delay(1);
delay(val);
delay(1);
delay(val);
delay(1);
delay(val);
delay(1);
delay(val);
delay(1);
delay(val);
// turn the ledPin off:
digitalWrite(ledPin, LOW);
// stop the program for for <sensorValue> milliseconds:
delay(val);
}