Need help with OPTICAL SENSOR TCRTC5500 and code

Hi everyone, i did this project and everything works…but I have 2 wishes:

  1. the sensor is not too much sensible as I would like, it just detect an object when is very close like few mm
    is there a way to change the sensibility a little bit?

  2. I would like that the led start ON and when the sensor detect an object go OFF for a minute and then go back to ON…easy…not for me I’m new here…
    Thanks to all that could help me…

Fenix1968

// Programa : Acionamento de led utilizando sensor óptico reflexivo
// Autor : Arduino e Cia

int sinalparaoled = 8; //Pino do led
int pinosensor = 7; //Ligado ao pino “coletor” do sensor óptico
int leitura; //Armazena informações sobre a leitura do sensor
int estadoled = 0; //Armazena o estado do led (ligado/desligado)

void setup()
{
pinMode(sinalparaoled, OUTPUT); //Define o pino do led como saida
pinMode(pinosensor, INPUT); //Define o pino do sensor como entrada
}

void loop()
{
//Le as informações do pino do sensor
leitura = digitalRead(pinosensor);
if (leitura != 1) //Verifica se o objeto foi detectado
{
while(digitalRead(pinosensor) != 1)
{
delay(100);
}

//Inverte o estado do led (ligado / desligado)
estadoled = !estadoled;

//Liga ou desliga o led conforme “estadoled”
digitalWrite(sinalparaoled, estadoled);
}
}