arduino uno program for ir sensor

ARDUINO UNO WITH IR SENSOR 

Hardware for this project-
 1. IR sensor
2. arduino uno r3
3. jumping wires
4. led (to show output)
 All Coding will done in arduino software.

CODING-

void setup() {
Serial.begin(9600);         // using serial monitor to check the outputs.Serial monitor is on top right of arduino
 pinMode(6,INPUT);                           software.Initially the value will 0 of IR sensor.
  pinMode(7,OUTPUT);                       If it detect object then value will be zero. when object will detect led
  }                                                         will glow. 

void loop() {
 int a=digitalRead(6);
 Serial.println(a);
  delay(100);
  if(a=0) { 
  
   digitalWrite(7,HIGH);
   delay(1000);  
  }
  else{
 digitalWrite(7,LOW);
    }
  
}


 GO to my link to get more codes about this- https://github.com/debasishduttajrt1?tab=repositories

Comments

Popular posts from this blog

what do you think about IOT?

arduino program for servo motor

SESSION 1 (8051 MICRO-CONTROLLER)