im new in this forum , i really want some help to this program, i want to put 3 inputs and when each combination of inputs its different my 6 lights will turn on in different secuency,
my problem its when i put in high my signal (freno) , im sorry if my english its poor.
pd: i put my code below, thankyou in advance
int DERECHA = 4;
int IZQUIERDA = 5;
int FRENO = 6;
void setup() {
pinMode(DERECHA,INPUT);
pinMode(IZQUIERDA,INPUT);
pinMode(FRENO,INPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
}
void loop() {
if(digitalRead(DERECHA)==HIGH && digitalRead(IZQUIERDA)==LOW && digitalRead(FRENO)==LOW)
{
digitalWrite(10,HIGH);
delay(350);
digitalWrite(11,HIGH);
delay(350);
digitalWrite(12,HIGH);
delay(350);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
delay(350);
}
if(digitalRead(DERECHA)==LOW && digitalRead(IZQUIERDA)==HIGH && digitalRead(FRENO)==LOW)
{
digitalWrite(9,HIGH);
delay(350);
digitalWrite(8,HIGH);
delay(350);
digitalWrite(7,HIGH);
delay(350);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
delay(350);
}
if(digitalRead(DERECHA)==HIGH && digitalRead(IZQUIERDA)==LOW && digitalRead(FRENO)==HIGH)
{
digitalWrite(10,HIGH);
delay(350);
digitalWrite(11,HIGH);
delay(350);
digitalWrite(12,HIGH);
delay(350);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
delay(350);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,HIGH);
}
else
{
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
}
if(digitalRead(DERECHA)==LOW && digitalRead(IZQUIERDA)==HIGH && digitalRead(FRENO)==HIGH)
{
digitalWrite(9,HIGH);
delay(350);
digitalWrite(8,HIGH);
delay(350);
digitalWrite(7,HIGH);
delay(350);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
delay(350);
digitalWrite(10,HIGH);
digitalWrite(11,HIGH);
digitalWrite(12,HIGH);
}
else
{
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
}
if(digitalRead(DERECHA)==HIGH && digitalRead(IZQUIERDA)==HIGH && digitalRead(FRENO)==LOW)
{
digitalWrite(9,HIGH);
digitalWrite(10,HIGH);
delay(350);
digitalWrite(8,HIGH);
digitalWrite(11,HIGH);
delay(350);
digitalWrite(7,HIGH);
digitalWrite(12,HIGH);
delay(350);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
delay(350);
}
if(digitalRead(FRENO)==HIGH && digitalRead(DERECHA)==LOW && digitalRead(IZQUIERDA)==LOW)
{
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
digitalWrite(10,HIGH);
digitalWrite(11,HIGH);
digitalWrite(12,HIGH);
}
else
{
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
}
}