From ae1a32d54910ad46f61797f6ad0da1ce3ffa93d5 Mon Sep 17 00:00:00 2001 From: Philipp Matthias Schaefer Date: Sun, 2 Feb 2020 21:10:22 +0100 Subject: [PATCH] Move constants and variables into one block --- arduino/door_status.ino | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/arduino/door_status.ino b/arduino/door_status.ino index be4d001..7a21a3d 100644 --- a/arduino/door_status.ino +++ b/arduino/door_status.ino @@ -8,6 +8,18 @@ const int RED_LED_OUTPUT_PIN = 12; const int YELLOW_LED_OUTPUT_PIN = 11; const int GREEN_LED_OUTPUT_PIN = 10; +const int DELAY_TIME = 1000; + +const int MAX_COUNTER = 20; +const int LOWER_THRESHOLD = 4; +const int UPPER_THRESHOLD = MAX_COUNTER - LOWER_THRESHOLD; + +const int CLOSED_DOOR = 1; +const int OPEN_DOOR = 0; + +int measured_state_counter = MAX_COUNTER / 2; +int published_state = OPEN_DOOR; + void setup(){ Serial.begin(9600); @@ -18,16 +30,6 @@ void setup(){ pinMode(GREEN_LED_OUTPUT_PIN, OUTPUT); } -const int DELAY_TIME = 1000; -const int MAX_COUNTER = 20; -const int LOWER_THRESHOLD = 4; -const int UPPER_THRESHOLD = MAX_COUNTER - LOWER_THRESHOLD; -const int CLOSED_DOOR = 1; -const int OPEN_DOOR = 0; - -int measured_state_counter = MAX_COUNTER / 2; -int published_state = OPEN_DOOR; - void print_status() { Serial.print(" "); Serial.print(published_state);