Hello friends, good morning; I need my program to start with the led1 on within the LOOP cycle; But that the interruption with button 3 turns it OFF and the interruption with button 2 turns it on again; However when I run the program in protoboard, the led1 is always kept on; What do I do ?, help please.
int boton1=2; ///microswitch del botador
int boton2=3; /// conpuerta 7404 de los sensores
int boton3=4; /// compuertas PUSH BOTTOM de monedero de arranque
int led1=8; //compuerta del push bottom
int led2=9; /// alimentación para los sensores
int led3=10; ///botador
int led4=11; /// despachador
int led5=12; ///flippers
int led6=13; /// led auxiliar
void setup() {
// put your setup code here, to run once:
pinMode(boton1, INPUT);
pinMode(boton2, INPUT);
pinMode(boton3, INPUT);
////////////////////////////////////
pinMode(led1, OUTPUT); ///
pinMode(led2, OUTPUT); ///
pinMode(led3, OUTPUT); ///
pinMode(led4, OUTPUT); ///
pinMode(led5, OUTPUT); ///
pinMode(led6, OUTPUT); ///
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(led1, HIGH); ///habilitar compuerta de push bottom
//////// boton1; boton1; boton1; boton1;boton1; boton1; boton1; boton1; boton1; microswitch del BOTADOR
if(digitalRead(boton1)==HIGH && digitalRead(boton2)==LOW && digitalRead(boton3)==LOW )
{
digitalWrite(led1, LOW); /// compuerta del push bottom de arranque se apaga
digitalWrite(led2, HIGH); /// SENSORES
digitalWrite(led3, LOW); /// botador
digitalWrite(led4, LOW); /// despachador
///////empieza la diversión amigos ///////////////
}
///////////// boton2; boton2; boton2; boton2;boton2;boton2;boton2; SEÑAL de los SENSORES
/////////// SE HAN LLENADO LOS HOYOS
if(digitalRead(boton1)==LOW && digitalRead(boton2)==HIGH && digitalRead(boton3)==LOW )
{
//////// función llamada por boton2 interrupción de llegada botador
// put your main code here, to run repeatedly:
{
for ( int i=0; i<8; i++) /// despachador 7777777777777777777 SEGUNDOS 77777777777777777777777
{
digitalWrite(led4, HIGH);
delay(300);
digitalWrite(led4, HIGH);
delay(300);
}
digitalWrite(led4, LOW);
}
digitalWrite(led2, LOW); /// SENSORES
digitalWrite(led3, LOW); /// botador
digitalWrite(led5, LOW); /// flippers
digitalWrite(led1, HIGH); /// compuerta del push bottom se habilita para recibir moneda
}
///////////// boton3; boton3;boton3; boton3;boton3; boton3;boton3; boton3; compúertas PUSH BOTTOM DEL MONEDERO DE ARRANQUE
if(digitalRead(boton1)==LOW && digitalRead(boton2)==LOW && digitalRead(boton3)==HIGH )
{
//////// función llamada por boton2 interrupción de llegada botador
// put your main code here, to run repeatedly:
digitalWrite(led1, LOW); /// compuerta del push bottom se apaga; no recibe moneda
digitalWrite(led2, LOW); /// SENSORES
digitalWrite(led3, HIGH); /// botador
digitalWrite(led4, LOW); /// despachador
digitalWrite(led5, HIGH); /// flippers
}
///////////// si ningún botón accionado sólo se prende el led 6
else if(digitalRead(boton1)==LOW && digitalRead(boton2)==LOW && digitalRead(boton3)== LOW )
{
digitalWrite(led1, LOW); /// compuerta del push bottom DE ARRANQUE
digitalWrite(led6, HIGH); /// compuerta del push bottom encendida
}
}
/////////////////////////////////////////////////////////////////////////////////