#3IR sensor with Arduino | amazing mj
In this #3rd arduino series tutorial i am going to show you how to interface IR sensor with Arduino.
What is IR proximity sensor?
>This IR Proximity Sensor is a multipurpose infrared sensor which can be used for obstacle sensing, color detection, fire detection, line sensing, etc and also as an encoder sensor. The sensor provides a digital output.
In this project we use obstacle sensing IR sensor. Which give high digital output (which means "1" ) when any obstacle detected.
What we need ?
>Arduino
>IR sensor
>LED
>220ohm resistor
>bread board (not mandatory)
>some wires
Arduino Code :-
//subcribe to amazing mj YouTube channel for more video tutorial
//visit the website(www.amazingmj.blogspot.com) for project detail
//this code is for turn on led with IR sensor
/**************************code******************************/
int state=0;
void setup() {
pinMode(3,INPUT);
pinMode(13,OUTPUT);
}
void loop() {
state=(digitalRead(3));
if(state==0)
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
}
//subcribe to amazing mj YouTube channel for more video tutorial
//visit the website(www.amazingmj.blogspot.com) for project detail
//this code is for turn on led with IR sensor
/**************************code******************************/
int state=0;
void setup() {
pinMode(3,INPUT);
pinMode(13,OUTPUT);
}
void loop() {
state=(digitalRead(3));
if(state==0)
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
}
Video Link :- https://youtu.be/81IR9-YYI2A
Follow me on instagram and facebook
Instagram :- amazing_mj_official
Comments
Post a Comment