Muhammad_Munir
Published © GPL3+

IR Obstacle Detector

How to make IR Obstacle Detector

BeginnerFull instructions provided17,484
IR Obstacle Detector

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
IR obstacle sensor
×1
Jumper wires (generic)
×1
LED
×1

Story

Read more

Code

Code

Arduino
int LED = 13;
int obstaclePin = 8;
int hasObstacle = HIGH;

void setup() 
{
  pinMode(LED, OUTPUT);
  pinMode(obstaclePin, INPUT);
    
}
void loop() {
  hasObstacle = digitalRead(obstaclePin);
  if (hasObstacle == LOW)
  {
   
    digitalWrite(LED, HIGH);
  }
  else
  {
    
    digitalWrite(LED, LOW);
  }
  delay(200);
}

Credits

Muhammad_Munir

Muhammad_Munir

77 projects • 48 followers
I am Arduino programmer, also expertise in ESP32 and 8266 wifi modules.

Comments