diff --git a/ITS_Open_direct_2fb/ITS_Open_direct_2fb.ino b/ITS_Open_direct_2fb/ITS_Open_direct_2fb.ino index cfae4da..eb7c291 100644 --- a/ITS_Open_direct_2fb/ITS_Open_direct_2fb.ino +++ b/ITS_Open_direct_2fb/ITS_Open_direct_2fb.ino @@ -54,9 +54,27 @@ const int rlight = 6; const int topen = 2; const int tclose = 3; +const int beeper = A5; + void setLeds(){ if (pingtimer>=0) { + if(hsopen){ // If space is not closed, beep three times with + //beep + if((pingtimer> 220)&&((pingtimer/5)%2 ==1)){ + digitalWrite(beeper, HIGH); + }else{ + digitalWrite(beeper, LOW); + } + + }else{ // if closed, beep once + //beep + if((pingtimer> 240)&&((pingtimer/5)%2 ==1)){ + digitalWrite(beeper, HIGH); + }else{ + digitalWrite(beeper, LOW); + } + } // blink like crazy if((pingtimer/2)%2 ==1){ analogWrite(rlight, 255); @@ -286,6 +304,8 @@ void setup() pinMode(glight, OUTPUT); pinMode(rlight, OUTPUT); + pinMode(beeper, OUTPUT); + digitalWrite(beeper,LOW); // Buttons with pullup resistor pinMode(topen, INPUT);