Created
May 5, 2017 20:47
-
-
Save HectorTorres/61a9e54f3d15824c2e1ebfab40dc941f to your computer and use it in GitHub Desktop.
Sensor inductivo NPN
This file contains 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
int pin=13; //declaras un pin digital | |
void setup() | |
{ | |
pinMode(pin,INPUT); //declaras el pin digital como entrada | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
if (digitalRead(13)==HIGH) //condición si el pin digital esta en estado alto te mostrara un 1 si no un 0 | |
{ | |
Serial.println(1); | |
} | |
else | |
{ | |
Serial.println(0); | |
} | |
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