IR Sensor Module

IR Sensor Module
Connect LED on pin No. 13 and gnd pin
connect IR sensor Module OUT on pin no. 2 of Arduino Uno.
Upload the  code and enjoy the circuit.



Code
---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

int IRsensorPin = 2;
int LEDpin=13;


void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  
  pinMode(IRsensorPin, INPUT);
  pinMode(LEDpin,OUTPUT);
}


void loop() {
  // read the input pin:
  int buttonState = digitalRead(pushButton);
  // print out the state of the button:
  Serial.println(buttonState);
digitalWrite(LEDpin,buttonState);

  delay(100);        // delay in between reads for stability
}


---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment

Wifi Home automation Diy kit

 Wifi Home automation Diy kit By Manmohan Pal Wifi Home Automation Kit Hi, This is Manmohan Pal, I am glad to present a DIY kit for Home Aut...