Inserir timer em um botão

Olá Fernando,

Consegui utilizar parte do seu código. Funfou!

Obrigado!

Segue código para quem precise de algo parecido.

int Led_red = 5;        
int Led_green = 3;
int botao = 4;
unsigned long millis_antes = 0;

void setup()
{
  pinMode(Led_red, OUTPUT);     
  pinMode(Led_green, OUTPUT);   
  pinMode(botao, INPUT_PULLUP);
  digitalWrite(Led_green, HIGH);
}
void loop()
{
  int start=digitalRead(botao);  
  if(digitalRead(botao) == false)
  {
    millis_antes = millis();
  }
  while(digitalRead(botao) == false)
{
   if((millis() - millis_antes) > 3000){
   alarma();
   }
   }
}

void alarma() {               
  for (int x=0; x<5; x++)     
  {                           
    digitalWrite(Led_red, HIGH);
    delay(500);                 
    digitalWrite(Led_red, LOW); 
    delay(500);
  }
  delay(100);                   
  digitalWrite(Led_red, HIGH);  
  delay(100);                   
  digitalWrite(Led_red, LOW);   
}