Last active
September 24, 2019 14:34
-
-
Save ceiborg/b5bd4f93f05a746464eeea0db237c60b to your computer and use it in GitHub Desktop.
Sensor Movimiento PIR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| #############%@ | |
| #### #########% | |
| ## #########& | |
| #% ########## | |
| ### ############ | |
| ################### ceiborg.com | |
| ################### tecnotextiles | |
| ################## | |
| ################# | |
| ############## | |
| ## | |
| # | |
| */ | |
| // Definir | |
| const int PIR = 4; // pin 4 va a la señal del sensor de movimiento | |
| const int LED = 13; | |
| int pir_lectura = 0; | |
| void setup() { | |
| // Configuración | |
| pinMode(LED, OUTPUT); // Configurar LED como salida o OUTPUT | |
| pinMode(PIR, INPUT); // Configurar pir como entrada o INPUT | |
| Serial.begin(9600); // Configurar el puerto serial a 9600 por si queremos monitoriar | |
| } | |
| void loop() { | |
| // Código principal donde ocurren en loop | |
| // Encender LED si hay movimiento | |
| pir_lectura = digitalRead(PIR); //leer el pin del sensor de movimiento PIR | |
| Serial.println (pir_lectura); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment