variable

hi there i'm trying to make an LED blink on and off but the daley i want variable from 5min to 25min
this code seems to turn the LED on and stays on but if i reduce the numbers down from 300000 to 30000 it seems to turn the LED off after 20seconds
any ideas what going on?

int sensorPin = A0;    // 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() {
  // read the value from the sensor:
  int sensorValue = analogRead(sensorPin);
  int sensor = map(sensorValue, 0, 1023, 300000UL, 1500000UL);  
  // turn the ledPin on
  digitalWrite(ledPin, HIGH);  
  // stop the program for <sensorValue> milliseconds:
  delay(sensor);          
  // turn the ledPin off:        
  digitalWrite(ledPin, LOW);   
  // stop the program for for <sensorValue> milliseconds:
  delay(sensor);                  
}

You're using an int when you should be using a long

ok whick on?

Sensor

You may want to look at the blink without delay example to see how to improve responsiveness.

am i on the right line?
i did noticed the LED starts LOW not HIGH?

const int ledPin =  13;      // the number of the LED pin
long sensorPin = A0;    // select the input pin for the potentiometer
long sensorValue = 0;  // variable to store the value coming from the sensor
// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated


void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);      
}

void loop()
{

  long sensorValue = analogRead(sensorPin);
  long sensor = map(sensorValue, 0, 1023, 30000UL, 1500000UL); 
  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > sensor) {

    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(ledPin, ledState);
  }
}

am i on the right line?

It probably took you as long to post as it would have done to find out.

i did noticed the LED starts LOW not HIGH?

Is that a problem? You can change it if you like.

will i have tried it lol
i tried changing the high and low around still not bring the LED on straight forward?

still not bring the LED on straight forward?

I don't understand what you're saying.

Set the LED pin to be high in the setup, just after you have set it to be an output.