Move status printing to own function

This commit is contained in:
Philipp Matthias Schaefer 2020-02-02 20:46:19 +01:00
parent 409ea1d056
commit bf2b754043

View file

@ -24,14 +24,19 @@ const int THRESHOLD = 20;
int space_status = THRESHOLD / 2;
int space_status_b4 = 0;
void loop(){
int pin_status = 0;
pin_status = digitalRead(REED_SWITCH_INPUT_PIN);
void print_status() {
Serial.print(" ");
Serial.print(space_status_b4);
Serial.print(" ");
Serial.println(space_status);
}
void loop(){
print_status();
int pin_status = 0;
pin_status = digitalRead(REED_SWITCH_INPUT_PIN);
// pin check of the reed sensor and low pass filter
if (pin_status == 0){