diegocali86

Laboratorio Timbre

Jun 19th, 2018
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. int boton =0;
  2.  
  3. void setup () {//Inicio
  4.  
  5. //Ponemos el pin 13 en modo salida
  6. pinMode (13,OUTPUT);
  7.  
  8. //Ponemos el pin 2 en modo entrada.
  9. pinMode (2,INPUT);
  10.  
  11. }//Fin
  12.  
  13. void loop(){
  14.  
  15. //Leemos el estado del botรณn conectado al pin2.
  16. boton = digitalRead(2);
  17.  
  18. //Si el valor es "Alto", es decir 5V, encendemos el Led.
  19.  
  20. if (boton == HIGH) {
  21. digitalWrite (13,HIGH);
  22. }
  23.  
  24. //Si el valor es "Bajo", es decir 0V. Apagamos el led
  25.  
  26. else{
  27. digitalWrite(13,LOW);
  28. }
  29. }
Add Comment
Please, Sign In to add comment