Proyecto Avance 2
Actividad: Conectar El arduino con el pulsador y el display de 7 segmento
Explicación de la clase
La miss nos explico que teníamos que conectar el arduino al pulsador y el display de 7 segmento siguiendo el ejemplo que esta en la imagen y después usar el programa de arduino para programar.
Código
int state = 0; // Variable lectura serial
int boton=2;
int valor=0;
void setup()
{
Serial.begin(9600);
pinMode(boton,INPUT);
}
void loop()
{
valor=digitalRead(boton);
delay(100);
if(valor==HIGH)
{
Serial.write("1");
}
}
Código 2
int LED = 13 ;
int boton = 2;
void setup()
{
pinMode( LED, OUTPUT) ; // LED como salida
pinMode( boton , INPUT) ; //botón como entrada
}
void loop()
{
int valor = digitalRead(boton) ; // leemos el valor de boton, si está presionado será HIGH y sino será LOW.
if(valor==HIGH)
{
digitalWrite(LED,HIGH) ;
delay(5000);
}
else
digitalWrite(LED,LOW) ;
}
//Fuentes relacionadas: http://www.prometec.net/entradas-digitales/
Código 3
int LED = 13 ;
int boton = 2;
void setup()
{
pinMode( LED, OUTPUT) ; // LED como salida
pinMode( boton , INPUT) ; //botón como entrada
}
void loop()
{
int valor = digitalRead(boton) ; // leemos el valor de boton, si está presionado será HIGH y sino será LOW.
if(valor==HIGH)
{
digitalWrite(LED,HIGH) ;
delay(5000);
}
else
digitalWrite(LED,LOW) ;
}
//Fuentes relacionadas: http://www.prometec.net/entradas-digitales/
Logros: Pudimos Terminarlo a tiempo
Dificultades:La progamacion