Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Creative solution
Published

IR Sensor Module

An Arduino tutorial.

BeginnerFull instructions provided49,241
IR Sensor Module

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
5 mm LED: Red
5 mm LED: Red
×1
Jumper wires (generic)
Jumper wires (generic)
×1
IR SENSOR
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

IR sensor module

Arduino
void setup() {
  // put your setup code here, to run once:
pinMode(4,INPUT);
pinMode(12,OUTPUT);//LED
}

void loop() {
  // put your main code here, to run repeatedly:
if(digitalRead(4)==LOW){
  digitalWrite(12,HIGH);
}
else{
  digitalWrite(12,LOW);
}
}

Credits

Creative solution
7 projects • 5 followers
Contact

Comments

Please log in or sign up to comment.