sábado, 2 de marzo de 2013

Laboratorio 2


Diagrama en protoboard




Diagrama esquemático




Fotos Montaje 











Código Arduino 


int led [6]={2,3,4,5,6,7};
int i;
int x;
// the setup routine runs once when you press reset:
void setup() {
pinMode(A1, INPUT);
for(int i=0;i<6;i++)
pinMode(i, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
x= analogRead(A1);
i=map(x,0,1023,0,5);
proceso(i);
}
void proceso(int i)
{

digitalWrite(led[i], HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led[i], LOW); // turn the LED off by making the voltage LOW
//delay(50); // wait for a second
}



Vídeo 




No hay comentarios:

Publicar un comentario