Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int boton =0;
- void setup () {//Inicio
- //Ponemos el pin 13 en modo salida
- pinMode (13,OUTPUT);
- //Ponemos el pin 2 en modo entrada.
- pinMode (2,INPUT);
- }//Fin
- void loop(){
- //Leemos el estado del botรณn conectado al pin2.
- boton = digitalRead(2);
- //Si el valor es "Alto", es decir 5V, encendemos el Led.
- if (boton == HIGH) {
- digitalWrite (13,HIGH);
- }
- //Si el valor es "Bajo", es decir 0V. Apagamos el led
- else{
- digitalWrite(13,LOW);
- }
- }
Add Comment
Please, Sign In to add comment