/**
Arduino Electronic Safe
Barrera fotoeletrica 3 señales
*/
const int LEDD0=2;
const int LEDD1=3;
const int LEDD2=4;
const int LEDD3=5;
const int LEDD4=6;
const int LEDD5=7;
const int LEDD6=8;
const int LEDout=13;
const int BOTON50=10;
const int BOTON320=11;
const int BOTON455=12;
int val;
void setup(){
pinMode(LEDD0,OUTPUT);
pinMode(LEDD1,OUTPUT);
pinMode(LEDD2,OUTPUT);
pinMode(LEDD3,OUTPUT);
pinMode(LEDD4,OUTPUT);
pinMode(LEDD5,OUTPUT);
pinMode(LEDD6,OUTPUT);
pinMode (LEDout,OUTPUT);
pinMode(BOTON50, INPUT);
pinMode(BOTON320, INPUT);
pinMode(BOTON455, INPUT);}
void loop(){
/*altura 50*/
val=digitalRead(BOTON50);
if (val==HIGH){
digitalWrite(LEDD0,HIGH);
digitalWrite(LEDD1,HIGH);
digitalWrite(LEDD2,HIGH);
digitalWrite(LEDD3,HIGH);
digitalWrite(LEDout,HIGH);
}
else { digitalWrite(LEDD0,LOW);
digitalWrite(LEDD1,LOW);
digitalWrite(LEDD2,LOW);
digitalWrite(LEDD3,LOW);
digitalWrite(LEDout,LOW);
}
/*altura 320*/
val=digitalRead(BOTON320);
if (val==HIGH){
digitalWrite(LEDD5,HIGH);
digitalWrite(LEDD6,HIGH);
digitalWrite(LEDout,HIGH);
}
else { digitalWrite(LEDD5,LOW);
digitalWrite(LEDD6,LOW);
digitalWrite(LEDout,LOW);
}
/*altura 455*/
val=digitalRead(BOTON455);
if (val==HIGH){
digitalWrite(LEDD1,HIGH);
digitalWrite(LEDD2,HIGH);
digitalWrite(LEDD4,HIGH);
digitalWrite(LEDD5,HIGH);
digitalWrite(LEDD6,HIGH);
digitalWrite(LEDout,HIGH);
}
else { digitalWrite(LEDD1,LOW);
digitalWrite(LEDD2,LOW);
digitalWrite(LEDD4,LOW);
digitalWrite(LEDD5,LOW);
digitalWrite(LEDD6,LOW);
digitalWrite(LEDout,LOW);
}
/*altura 50 Y 320*/
val=digitalRead(BOTON50);
val=digitalRead(BOTON320);
if (val==HIGH){
digitalWrite(LEDD5,HIGH);
digitalWrite(LEDD6,HIGH);
digitalWrite(LEDout,HIGH);
}
else { digitalWrite(LEDD5,LOW);
digitalWrite(LEDD6,LOW);
digitalWrite(LEDout,LOW);
}
/*altura 50,320 y 455*/
val=digitalRead(BOTON50);
val=digitalRead(BOTON320);
val=digitalRead(BOTON455);
if (val==HIGH){
digitalWrite(LEDD1,HIGH);
digitalWrite(LEDD2,HIGH);
digitalWrite(LEDD4,HIGH);
digitalWrite(LEDD5,HIGH);
digitalWrite(LEDD6,HIGH);
digitalWrite(LEDout,HIGH);
}
else { digitalWrite(LEDD1,LOW);
digitalWrite(LEDD2,LOW);
digitalWrite(LEDD4,LOW);
digitalWrite(LEDD5,LOW);
digitalWrite(LEDD6,LOW);
digitalWrite(LEDout,LOW);
}
/*altura 50 y 455*/
val=digitalRead(BOTON50);
val=digitalRead(BOTON455);
if (val==HIGH){
digitalWrite(LEDD1,HIGH);
digitalWrite(LEDD2,HIGH);
digitalWrite(LEDD4,HIGH);
digitalWrite(LEDD5,HIGH);
digitalWrite(LEDD6,HIGH);
digitalWrite(LEDout,HIGH);
}
else { digitalWrite(LEDD1,LOW);
digitalWrite(LEDD2,LOW);
digitalWrite(LEDD4,LOW);
digitalWrite(LEDD5,LOW);
digitalWrite(LEDD6,LOW);
digitalWrite(LEDout,LOW);
}
/*altura 320 y 455*/
val=digitalRead(BOTON320);
val=digitalRead(BOTON455);
if (val==HIGH){
digitalWrite(LEDD1,HIGH);
digitalWrite(LEDD2,HIGH);
digitalWrite(LEDD4,HIGH);
digitalWrite(LEDD5,HIGH);
digitalWrite(LEDD6,HIGH);
digitalWrite(LEDout,HIGH);
}
else { digitalWrite(LEDD1,LOW);
digitalWrite(LEDD2,LOW);
digitalWrite(LEDD4,LOW);
digitalWrite(LEDD5,LOW);
digitalWrite(LEDD6,LOW);
digitalWrite(LEDout,LOW);
}
}