IR Sensor Interface Arduino

In this Project, we will see about how to interface IR sensor with Arduino.

Circuit Diagram:

Arduino Code:
ir_sensor_code.ino
//This Code is Developed by Sdev
//Follow Us Here : https://youtube.com/sdevelectronics

#define IRpin 8                       //IR Output pin to D8
#define LEDpin 13                     //LED connect to D13

void setup() {
  Serial.begin(9600);
  pinMode(IRpin, INPUT);              //Set IRpin to INPUT
  pinMode(LEDpin, OUTPUT);            //Set LEDpin to OUTPUT
}

void loop() {
  if (digitalRead(IRpin) == HIGH) {   //Reads IR Status (HIGH or LOW)
    digitalWrite(LEDpin, HIGH);       //Turns ON LED
    Serial.println("IR = HIGH");      //Message in Serial Monitor
  }
  else {
    digitalWrite(LEDpin, LOW);        //Turns OFF LED
    Serial.println("IR = LOW");       //Message in Serial Monitor
  }
  delay(100);
}

Youtube Video Tutorial:




Download our official Android App in PlayStore. Click Here
You can get the all the required files (like Circuit Diagram, Arduino.ino file, Libraries Used, and others) for the project  in ZIP format and much more...

No comments:

Post a Comment