When switch is held down for 10min. then led will go high.

I would like some help or tell me where I can look for help.
What I am going to use is= one Led and one switch.

What I am shooting for is=
When the switch is held down for more then 10 minutes or more, after the switch is let go the led will go on (high).
But if the switch is held for 2 minutes or (less then the 10min.) and then let go, the led will be off or (low).

const int buttonPin = 11;     // the number of the pushbutton pin
const int ledPin =  3;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);    
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {    
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  }
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}

I think it's something like this. But I don't know how to do the time, as for how long the switch is held down.

const int buttonPin = 11;     // the number of the pushbutton pin
const int ledPin =  3;      // the number of the LED pin
int held;
int time;


int buttonState = 0;        

void setup() {
 
  pinMode(ledPin, OUTPUT);      
 
  pinMode(buttonPin, INPUT);    
}

void loop(){
 
  held = digitalRead(buttonPin);
  time = (held + 1);
  
   Serial.println(time);

  if (time >= 100) {    
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  }
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}

Have a look at the millis() function.

  held = digitalRead(buttonPin);
  time = (held + 1);

So, time will be 1 or 2.

  if (time >= 100) {

In my experience, 2 is not ever greater than or equal 100. YMMV.

Look at the state change detection example, to learn how to detect when the switch becomes pressed, and when the switch becomes released. Then, as AWOL says, use millis() to record when each event happens. The difference between the event times tells you how long the switch was held down.

How do I start and stop the (time =millis():wink: to turn on and off the led?

Here is my code

const int  buttonPin = 11;    
const int ledPin = 3;       


int buttonPushCounter = 0;   
int buttonState = 0;         
int lastButtonState = 0;     
int time ;

void setup() {
 
  pinMode(buttonPin, INPUT);
 
  pinMode(ledPin, OUTPUT);
  
  Serial.begin(9600);
}


void loop() {
 
  buttonState = digitalRead(buttonPin);

 
  if (buttonState != lastButtonState) {
   
    if (buttonState == HIGH) {
      time =millis();
     
     
      Serial.println("on");
      Serial.println(time);
      
    }
    else {

      Serial.println("off");
    }
  }
  
  lastButtonState = buttonState;
   
  if (time >= 1000) {
    digitalWrite(ledPin, HIGH);
  } else {
   digitalWrite(ledPin, LOW);
  }
 
}

You don't stop the millis() counter - it runs continuously just like your wristwatch.

Suppose you want something to operate for 1000 millisecs

record the time at the start with "unsigned long startMillis = millis();"
and then in every iteration of loop() check how much time has elapsed with

 if (millis() - startMillis >= 1000) {
    // do whatever is needed when the time has elapsed
 }

...R

Once a "5 consecutive second" threshold is crossed, LED 13 goes On.
And it stays on till the Reset button is pushed or you include a separate reset option

//  trippoint5sec
//
//  wait for 5 seconds
//  of constant detection
//

unsigned long refTime;
unsigned long trippoint;
const long threshold = 5000;   // 5 sec or your choice
byte DET;
const byte pirPin = 8;  // == button, etc
const byte ledPin = 13;

void setup ()
{
  //pirPin is INPUT by default, use ExtPullup
  pinMode (ledPin,OUTPUT);
  digitalWrite (ledPin,LOW);
}

void loop ()
{
  DET = digitalRead(pirPin);
  if (DET == 1)  // inactive
  {
    refTime = millis();
    trippoint = refTime;
  }
  else   // Active Low
  {
    pir_active();
  }
}

void pir_active ()
{
  trippoint = millis();
  if ((trippoint-refTime) > threshold)
  {
    digitalWrite(ledPin,HIGH);
  }
}

code tags

Thank You very much Runaway Pancake, I appreciate your help, and all the other people that helped me out.