Move led update code to own function

This commit is contained in:
Philipp Matthias Schaefer 2020-02-02 21:00:07 +01:00
parent 924d873aa9
commit bd5dc49a92

View file

@ -51,16 +51,7 @@ void update_published_state() {
} }
} }
void loop(){ void update_led_pins() {
print_status();
update_measured_state_counter();
update_published_state();
delay(DELAY_TIME);
// ampel / traffic light signals
if (published_state == CLOSED_DOOR) { if (published_state == CLOSED_DOOR) {
digitalWrite(RED_LED_OUTPUT_PIN, HIGH); digitalWrite(RED_LED_OUTPUT_PIN, HIGH);
digitalWrite(GREEN_LED_OUTPUT_PIN, LOW); digitalWrite(GREEN_LED_OUTPUT_PIN, LOW);
@ -75,3 +66,15 @@ void loop(){
digitalWrite(YELLOW_LED_OUTPUT_PIN, LOW); digitalWrite(YELLOW_LED_OUTPUT_PIN, LOW);
} }
} }
void loop(){
print_status();
update_measured_state_counter();
update_published_state();
delay(DELAY_TIME);
update_led_pins();
}