Arduino refactoring #4
1 changed files with 9 additions and 4 deletions
|
@ -24,14 +24,19 @@ const int THRESHOLD = 20;
|
||||||
int space_status = THRESHOLD / 2;
|
int space_status = THRESHOLD / 2;
|
||||||
int space_status_b4 = 0;
|
int space_status_b4 = 0;
|
||||||
|
|
||||||
void loop(){
|
void print_status() {
|
||||||
int pin_status = 0;
|
|
||||||
|
|
||||||
pin_status = digitalRead(REED_SWITCH_INPUT_PIN);
|
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.print(space_status_b4);
|
Serial.print(space_status_b4);
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.println(space_status);
|
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
|
// pin check of the reed sensor and low pass filter
|
||||||
if (pin_status == 0){
|
if (pin_status == 0){
|
||||||
|
|
Reference in a new issue