Controlling Delay with a potentiometer

Thanks Outsider

It did almost fix it totally but the HOURS_MAX = 22,096,800 is still bad.

And if you read ''long int''

It should go up to 2,147,483,647.

I posted a Print-screen whit the result.

In the mean time, I did program the timer with a different syntax.

int potMin = 0;    // potentiometer minute time
int potHours = 1;    // potentiometer hours time
int ledMin = 12;     // select the pin for the minute LED
int ledHours = 11;     // select the pin for the hours LED
int MinuteVal = 0;    // variable to store the value coming from the sensor
int HoursVal = 0;    // variable to store the value coming from the sensor

void setup() {
  pinMode(ledMin, OUTPUT);                // declare the ledPin as an OUTPUT
  pinMode(ledHours, OUTPUT);             // declare the ledPin as an OUTPUT
  Serial.begin(9600);
}
void loop() {
  MinuteVal = analogRead(potMin);            // read the value from the Minute  sensor
  HoursVal = analogRead(potHours);        // read the value from the Hours sensor

   digitalWrite(ledMin, LOW);                           // turn the led min  ON
   digitalWrite(ledHours, HIGH);                        // turn the led hours OFF   
   if (MinuteVal <= 85 ) delay ( 1000*10 );             // 85 is the MinuteVal coresponding to 10 sec
   if ( MinuteVal > 85 ) delay (MinuteVal*60UL*2UL);    // max 2 min

   digitalWrite(ledMin, HIGH);                          // turn the led min OFF
   digitalWrite(ledHours, LOW);                         // turn the led hours ON
   if (HoursVal <= 85 ) delay ( 1000*60*30 );           //  85 is the HoursVal coresponding to 30 min
   if (HoursVal > 85 ) delay(HoursVal*60UL*60UL*6UL);   // max 6 hours       
}