Proteus Simulation for IR Proximity Sensor module with Arduino
Proteus Simulation for IR Proximity Sensor module with Arduino
// Interfacing Infrared Proximity sensor Module with Arduino
void setup()
{
pinMode(12,OUTPUT);//connect LED to Digital Pin 12 of Arduno
pinMode(3,INPUT);// connect OUTPUT pin of IR Sensor to Digital Pin 3 of Arduino
Serial.begin(9600);
}
void loop()
{
if (digitalRead(3)== HIGH )// (if any obstruction in front of IR sensor-Output will go HIGH)
{
digitalWrite(12,HIGH);// Turn on the LED
delay(10);
}
else
{
digitalWrite(12,LOW);// else ,Turn OFF the LED
delay(10);
}
}
Comments
Post a Comment