From bd5dc49a9214970c5da6ffe0cd728ce80bc5d969 Mon Sep 17 00:00:00 2001 From: Philipp Matthias Schaefer Date: Sun, 2 Feb 2020 21:00:07 +0100 Subject: [PATCH] Move led update code to own function --- arduino/door_status.ino | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/arduino/door_status.ino b/arduino/door_status.ino index 7587235..0a2f58b 100644 --- a/arduino/door_status.ino +++ b/arduino/door_status.ino @@ -51,16 +51,7 @@ void update_published_state() { } } -void loop(){ - print_status(); - - update_measured_state_counter(); - - update_published_state(); - - delay(DELAY_TIME); - - // ampel / traffic light signals +void update_led_pins() { if (published_state == CLOSED_DOOR) { digitalWrite(RED_LED_OUTPUT_PIN, HIGH); digitalWrite(GREEN_LED_OUTPUT_PIN, LOW); @@ -75,3 +66,15 @@ void loop(){ digitalWrite(YELLOW_LED_OUTPUT_PIN, LOW); } } + +void loop(){ + print_status(); + + update_measured_state_counter(); + + update_published_state(); + + delay(DELAY_TIME); + + update_led_pins(); +}