Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sensor inductivo NPN
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