sábado, 18 de julio de 2015

Arduino [buttons led / boton led ] 02

Arduino [buttons led / boton led ] 02

circuito usando fritzing

//variable estado
int estado = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode(8, INPUT); // pin 8 de entrada input
  pinMode(4, OUTPUT);//pin 4 salida
}

void loop() {
  // put your main code here, to run repeatedly:
  estado = digitalRead(8);
 
  if(estado == HIGH){
    digitalWrite(4, HIGH);
  }
  else{
    digitalWrite(4, LOW);
  }
}



0 comentarios:

Publicar un comentario