Move constants and variables into one block

This commit is contained in:
Philipp Matthias Schaefer 2020-02-02 21:10:22 +01:00
parent ad97be1295
commit ae1a32d549

View file

@ -8,6 +8,18 @@ const int RED_LED_OUTPUT_PIN = 12;
const int YELLOW_LED_OUTPUT_PIN = 11; const int YELLOW_LED_OUTPUT_PIN = 11;
const int GREEN_LED_OUTPUT_PIN = 10; 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(){ void setup(){
Serial.begin(9600); Serial.begin(9600);
@ -18,16 +30,6 @@ void setup(){
pinMode(GREEN_LED_OUTPUT_PIN, OUTPUT); 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() { void print_status() {
Serial.print(" "); Serial.print(" ");
Serial.print(published_state); Serial.print(published_state);