
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
descripción de sensores a utilizar
Typology: Summaries
1 / 1
This page cannot be seen from the preview
Don't miss anything!

int ledPin = 7; // Salida al LED que visualiza la detección de un Objeto o Superficie Blanca int sensorPin = 8; //Recibe la Señal del Sensor int estado; //variable utilizada para capturar el valor del sensor. void setup(){ pinMode(ledPin, OUTPUT); //Se define el pin del LED de salida. pinMode(sensorPin,INPUT); //Se define el pin de Entrada del Sensor. } void loop() { estado = digitalRead(sensorPin); //Lee el estado del Sensor o Detección de Blanco/Negro. if (estado == HIGH) { //Objeto detectado o Superficie Blanca digitalWrite(ledPin,LOW); //Se apaga el LED indicando la presencia de un Objeto o Superficie Blanca. } else { digitalWrite(ledPin,HIGH); //El indicador del LED esta prendido si la superficie es Negra o No hay Objeto } }