tinance2-doorlock-controller/src/buzzer_ctl.cpp

40 lines
No EOL
645 B
C++

#include "buzzer_ctl.h"
void short_beep()
{
#ifdef ALARM_PIN
digitalWrite(ALARM_PIN, LOW);
delay(50);
digitalWrite(ALARM_PIN, HIGH);
#endif
}
void granted_beep()
{
#ifdef ALARM_PIN
digitalWrite(ALARM_PIN, LOW);
delay(50);
digitalWrite(ALARM_PIN, HIGH);
delay(50);
digitalWrite(ALARM_PIN, LOW);
delay(50);
digitalWrite(ALARM_PIN, HIGH);
delay(50);
digitalWrite(ALARM_PIN, LOW);
delay(50);
digitalWrite(ALARM_PIN, HIGH);
#endif
}
void denied_beep(void)
{
#ifdef ALARM_PIN
for (int i=0; i<100; i++)
{
delay(4);
digitalWrite(ALARM_PIN, LOW);
delay(4);
digitalWrite(ALARM_PIN, HIGH);
}
#endif
}