Move space_status update to own function
This commit is contained in:
parent
bf2b754043
commit
da152247ac
1 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
|
|
Reference in a new issue