mirror of
https://github.com/bitlair/bitlair_doorduino.git
synced 2025-05-13 12:20:07 +02:00
added: sound the horn 3 times when there is no mains power
This commit is contained in:
parent
f5a3d726b4
commit
c368af1eb4
1 changed files with 23 additions and 1 deletions
|
@ -45,6 +45,8 @@
|
|||
OneWire ds(PIN_1WIRE);
|
||||
DS1961 ibutton(&ds);
|
||||
|
||||
bool HasMainsPower();
|
||||
|
||||
int Serialprintf (const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
int Serialprintf (const char* fmt, ...)
|
||||
|
@ -147,6 +149,7 @@ void setup()
|
|||
|
||||
pinMode(PIN_LEDGREEN, OUTPUT);
|
||||
pinMode(PIN_LEDRED, OUTPUT);
|
||||
pinMode(PIN_MAINS_POWER, INPUT);
|
||||
|
||||
SetLEDState(LEDState_Off);
|
||||
|
||||
|
@ -494,11 +497,30 @@ void ToggleLock()
|
|||
digitalWrite(PIN_OPEN, LOW);
|
||||
}
|
||||
|
||||
DelayLEDs(10000);
|
||||
if (HasMainsPower())
|
||||
{
|
||||
DelayLEDs(10000);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (uint8_t i = 0; i < 3; i++)
|
||||
{
|
||||
digitalWrite(PIN_HORN, HIGH);
|
||||
DelayLEDs(250);
|
||||
digitalWrite(PIN_HORN, LOW);
|
||||
DelayLEDs(250);
|
||||
}
|
||||
DelayLEDs(8500);
|
||||
}
|
||||
|
||||
Serial.println("finished lock action");
|
||||
}
|
||||
|
||||
bool HasMainsPower()
|
||||
{
|
||||
return digitalRead(PIN_MAINS_POWER) == HIGH;
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
uint8_t addr[ADDRSIZE];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue