Diagrama en protoboard
Diagrama esquemático
Fotos Montaje
Código Arduino
int led
[6]={2,3,7,8,9,10};
int a,b,pot1,pot2;
// the
setup routine runs once when you press reset:
void
setup() {
for(int i=0;i<6;i++)
pinMode(led[i], OUTPUT);
pinMode(A4, INPUT);
pinMode(A2, INPUT);
}
// the
loop routine runs over and over again forever:
void loop()
{
for(int i=0;i<6;i++)
proceso(i);
for(int i=4;i>0;i--)
proceso(i);
pot1=analogRead(A4);
a=map(pot1,0,1023,0,20);
pot2=analogRead(A2);
b=map(pot2,0,1023,0,20);
}
void
proceso(int i)
{
digitalWrite(led[i], HIGH); // turn the LED on (HIGH is the voltage
level)
delay(x); // wait for a second
digitalWrite(led[i], LOW); // turn the LED off by making the voltage
LOW
delay(y);
}
delay(y);
}
No hay comentarios:
Publicar un comentario