#define ev 4 //elevator status pin
#define L1 5 //door lock 1 (old)
#define L2_0 6 //door lock 2 (new)
#define LL1 7
#define LL2_0 8
#define LEV 9
#define LGTG 10
#define gtg 12 //good to go pin for elvator
void setup() {
pinMode(ev, INPUT);
pinMode(L1, INPUT);
pinMode(L2_0, INPUT);
pinMode(LL1, OUTPUT);
pinMode(LL2_0, OUTPUT);
pinMode(LEV, OUTPUT);
pinMode(LGTG, OUTPUT);
pinMode(gtg, OUTPUT);
}
void loop(){
if (digitalRead(ev) == LOW){
digitalWrite(LEV,LOW);
if (digitalRead(L1) == HIGH){
digitalWrite(LL1,HIGH);
if (digitalRead(L2_0) == HIGH){
digitalWrite(gtg,HIGH);
digitalWrite(LGTG,HIGH);
digitalWrite(LL2_0,HIGH);
}
else{
digitalWrite(gtg,LOW);
digitalWrite(LGTG,LOW);
digitalWrite(LL2_0,LOW);
}
}
else{
digitalWrite(gtg,LOW);
digitalWrite(LGTG,LOW);
digitalWrite(LL1,LOW);
}
}
else if (digitalRead(ev) == HIGH){
digitalWrite(LEV,HIGH);
if (digitalRead(L1) == HIGH){
digitalWrite(LL1,HIGH);
if (digitalRead(L2_0) == HIGH){
digitalWrite(gtg,HIGH);
digitalWrite(LGTG,HIGH);
digitalWrite(LL2_0,HIGH);
}
else{
digitalWrite(gtg,LOW);
digitalWrite(LGTG,LOW);
digitalWrite(LL2_0,LOW);
}
}
else{
digitalWrite(gtg,LOW);
digitalWrite(LGTG,LOW);
digitalWrite(LL1,LOW);
}
}
}