Arduino refactoring #4

Open
fiveop wants to merge 28 commits from fiveop/arduino_refactoring into master
Showing only changes of commit 517d131689 - Show all commits

View file

@ -8,8 +8,6 @@
#define space_status_yellow_PIN 11 #define space_status_yellow_PIN 11
#define space_status_green_PIN 10 #define space_status_green_PIN 10
void setup(){ void setup(){
Serial.begin(9600); Serial.begin(9600);
pinMode(IR_INPUT_PIN, INPUT); pinMode(IR_INPUT_PIN, INPUT);
@ -19,17 +17,14 @@ void setup(){
pinMode(space_status_green_PIN, OUTPUT); pinMode(space_status_green_PIN, OUTPUT);
} }
int threshold = 20; int threshold = 20;
int space_status = threshold / 2; int space_status = threshold / 2;
int space_status_b4 = 0; int space_status_b4 = 0;
int delay_time = 1000; int delay_time = 1000;
void loop(){ void loop(){
int pin_status = 0; int pin_status = 0;
pin_status = digitalRead(IR_INPUT_PIN); pin_status = digitalRead(IR_INPUT_PIN);
Serial.print(" "); Serial.print(" ");
Serial.print(space_status_b4); Serial.print(space_status_b4);
@ -37,7 +32,6 @@ void loop(){
Serial.println(space_status); Serial.println(space_status);
delay(delay_time); delay(delay_time);
// 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){
if (space_status > 0){ if (space_status > 0){
@ -49,7 +43,6 @@ void loop(){
} }
} }
// status check if we can switch the status. // status check if we can switch the status.
// low pass prevents waggling a bit // low pass prevents waggling a bit
if (space_status >= threshold-3) { if (space_status >= threshold-3) {
@ -60,7 +53,6 @@ void loop(){
space_status_b4 = 0; space_status_b4 = 0;
} }
// ampel / traffic light signals // ampel / traffic light signals
if (space_status_b4 == 1) { if (space_status_b4 == 1) {
// closed // closed