patriotaSJ

Botón enciende led

Apr 19th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. //blog http://cursoarduinomega.blogspot.com/2015/04/boton-enciende-led.html
  2. int boton = 4;
  3. int led = 6;
  4.  
  5. void setup() {
  6.   pinMode(boton, INPUT);
  7.   pinMode(led, OUTPUT);
  8. }
  9.  
  10. int estado = 0;
  11.  
  12. void loop() {
  13.   estado = digitalRead(boton);
  14.   if(estado == HIGH){
  15.     digitalWrite(led, HIGH);
  16.   }else{
  17.     digitalWrite(led, LOW);
  18.   }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment