Switched Door sensor to input_pullup and swapped logic
This commit is contained in:
parent
77615d691a
commit
eb26fd8ff9
|
@ -54,7 +54,7 @@ void setup() {
|
||||||
// Setup various digital/analog inputs
|
// Setup various digital/analog inputs
|
||||||
pinMode(PIN_ALWAYS_ON, INPUT);
|
pinMode(PIN_ALWAYS_ON, INPUT);
|
||||||
pinMode(PIN_WHITE, INPUT);
|
pinMode(PIN_WHITE, INPUT);
|
||||||
pinMode(PIN_DOOR, INPUT);
|
pinMode(PIN_DOOR, INPUT_PULLUP);
|
||||||
pinMode(POT_BRIGHT, INPUT);
|
pinMode(POT_BRIGHT, INPUT);
|
||||||
pinMode(POT_COLOR, INPUT);
|
pinMode(POT_COLOR, INPUT);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void loop() {
|
||||||
raw_color = analogRead(POT_COLOR); // Color (0-1024)
|
raw_color = analogRead(POT_COLOR); // Color (0-1024)
|
||||||
always_on = (digitalRead(PIN_ALWAYS_ON) == HIGH); // Toggle button pressed == ALWAYS ON
|
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
|
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
|
// Set RGB array to values as appropriate
|
||||||
if (white) {
|
if (white) {
|
||||||
|
|
Reference in a new issue