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