From eb26fd8ff98bfa9a7cd6c0f9f37beab1a88d2b17 Mon Sep 17 00:00:00 2001 From: Mike C Date: Sun, 9 Aug 2015 16:49:44 -0400 Subject: [PATCH] Switched Door sensor to input_pullup and swapped logic --- src/src.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/src.ino b/src/src.ino index 414fdb5..4d6dadf 100644 --- a/src/src.ino +++ b/src/src.ino @@ -54,7 +54,7 @@ void setup() { // Setup various digital/analog inputs pinMode(PIN_ALWAYS_ON, INPUT); pinMode(PIN_WHITE, INPUT); - pinMode(PIN_DOOR, INPUT); + pinMode(PIN_DOOR, INPUT_PULLUP); pinMode(POT_BRIGHT, INPUT); pinMode(POT_COLOR, INPUT); @@ -98,7 +98,7 @@ void loop() { raw_color = analogRead(POT_COLOR); // Color (0-1024) always_on = (digitalRead(PIN_ALWAYS_ON) == HIGH); // Toggle button pressed == ALWAYS ON white = (digitalRead(PIN_WHITE) == HIGH); // Shorted pin to enable white color for LEDs - door_open = (digitalRead(PIN_DOOR == HIGH)); // SparkFun door sensor is indicating door is open (NO for door closed state) + door_open = (digitalRead(PIN_DOOR == LOW)); // SparkFun door sensor is indicating door is open (NO for door closed state, set as input_pullup so the logic is inverted) // Set RGB array to values as appropriate if (white) {