Last active
October 1, 2019 14:07
-
-
Save ceiborg/8b76f1a32898d3ce4b1bc6459b2d757d to your computer and use it in GitHub Desktop.
Sensor de proximidad inductivo NPN - LJ12A3-4-Z / BX
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 | |
| ################## | |
| ################# | |
| ############## | |
| ## | |
| # | |
| */ | |
| // para Sensor de proximidad inductivo NPN - LJ12A3-4-Z / BX | |
| /* | |
| - Modelo: LJ12A3-4-Z / BX | |
| - Voltaje de funcionamiento: 6 - 36VDC | |
| - Corriente de salida: 300mA | |
| - Polaridad: NPN | |
| - Distancia de detección: 4 mm / 2 mm para aluminio | |
| - Estado de salida: NA ( normalmente abierto) | |
| */ | |
| // conectar el cable Marrón a (+)una fuente 6 - 36VDC - 300mA, cable azul GND (vincular las masas con arduino), y cable negro a pin 8 del arduino. | |
| int pin=8; //declaras un pin digital en una variable que solo recibe 0 - 1 | |
| void setup() | |
| { | |
| pinMode(pin,INPUT); //declaras el pin digital como entrada | |
| Serial.begin(9600); | |
| } | |
| void loop() | |
| { | |
| if (digitalRead(pin)==HIGH) //condición si el pin digital esta en estado alto te mostrara un 1 si no un 0 | |
| { | |
| Serial.println("no se detecta material metálico"); | |
| } | |
| else | |
| { | |
| Serial.println("material metálico detectado"); | |
| } | |
| delay(1000); //tiempo en mili segundos de cada muestreo | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment