Keypad Timmer
Keypad Timmer
h>
#define LED_DATA 5 //Pin connected to DS of 74HC595
#define LED_CLK 4 //Pin connected to SH_CP of 74HC595
#define LED_LATCH 18 //Pin connected to ST_CP of 74HC595
#define BEEPER 2
void setup() {
pinMode(LED_LATCH, OUTPUT);
pinMode(LED_CLK, OUTPUT);
pinMode(LED_DATA, OUTPUT);
pinMode(BEEPER, OUTPUT);
}
void loop() {
char secondsleft = keypad.getKey();
while(secondsleft>0){
secondsleft -= 1;
seconds2LED(secondsleft);
secondsleft==0 ? theEnd() : beep();
}
}
void beep(){
digitalWrite(BEEPER,HIGH);
delay(40);
digitalWrite(BEEPER,LOW);
delay(960);
}
void theEnd(){
digitalWrite(BEEPER,HIGH);
delay(2000);
digitalWrite(BEEPER,LOW);
}