Move space_status update to own function

This commit is contained in:
Philipp Matthias Schaefer 2020-02-02 20:48:18 +01:00
parent bf2b754043
commit da152247ac

View file

@ -31,9 +31,7 @@ void print_status() {
Serial.println(space_status);
}
void loop(){
print_status();
void update_space_status() {
int pin_status = 0;
pin_status = digitalRead(REED_SWITCH_INPUT_PIN);
@ -48,6 +46,12 @@ void loop(){
space_status += 1;
}
}
}
void loop(){
print_status();
update_space_status();
// status check if we can switch the status.
// low pass prevents waggling a bit