Pixel LED ws2812 Projects

▼

Arduino Nano

▼

Arduino basic Tutorial

▼

Blynk iot Tutorial

▼

Visit all the Links

▼

ArduinoTutorial by Manmohan Pal

▼
▼

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