Abstract relay

This commit is contained in:
Tanner Collin 2018-11-07 19:14:59 -07:00
parent a12a24661b
commit 01b8d29a45

View File

@ -120,6 +120,9 @@ void greenLEDOff() { digitalWrite(GREEN_LED_PIN, LED_OFF); }
void redLEDOn() { digitalWrite(RED_LED_PIN, LED_ON); }
void redLEDOff() { digitalWrite(RED_LED_PIN, LED_OFF); }
void relayOn() { digitalWrite(RELAY_PIN, RELAY_CLOSED); }
void relayOff() { digitalWrite(RELAY_PIN, RELAY_OPEN); }
void processLockState()
{
switch (lockState) {
@ -127,7 +130,7 @@ void processLockState()
greenLEDOff();
redLEDOn();
digitalWrite(RELAY_PIN, RELAY_OPEN);
relayOff();
break;
case LOCK_PREARM:
if (!greenButton() && !redButton()) {
@ -141,7 +144,7 @@ void processLockState()
greenLEDOff();
redLEDOn();
digitalWrite(RELAY_PIN, RELAY_OPEN);
relayOff();
if (redButton()) {
if (LOGGING) Serial.println("[INFO] Unarming interlock.");
@ -164,7 +167,7 @@ void processLockState()
greenLEDOn();
redLEDOff();
digitalWrite(RELAY_PIN, RELAY_CLOSED);
relayOn();
if (redButton()) {
if (LOGGING) Serial.println("[INFO] Off button pressed.");