if (estadobotao==0) {
//digitalWrite(led,HIGH);
// delay(3000);
}
else {
digitalWrite(led,LOW); //Botão não pressionado, apaga o led.
wtempo=millis(); //tempo em milisegundos
}
if (millis()-wtempo > 3000) { // inicia o modo de programação
programa();
}
estadobotao is digitalRead() of botao (pin 3) which was set to INPUT_PULLUP.
So, if pressed, do nothing.
If not pressed set wtemp= millis().
I don't see how the next statement can ever be true to call programa().
EDIT:
I am wrong. If you hold the button down for longer than three seconds, I think you will enter programa(). Can you get some serial output to help you debug? Are you actually setting the alarms[] correctly in programa()?