LED Blinking after connecting to PIR sensor
Posted: Sat May 26, 2018 4:10 pm
Hi,
I have NodeMCU v3, a LED and a PIR unit.
I try to turn on led with the value of PIR, following tutorial http://www.electronicwings.com/nodemcu/pir-interfacing-with-nodemcu:
However the builtin blue LED and my green led are blinking interchangeably (green turns on, stays for 1 sec, turns off and built-in blue turns on, stays for 1 second, turns off, green turns on. ..). Any ideas why it's behaving like that? It does not care about motion.
I have NodeMCU v3, a LED and a PIR unit.
I try to turn on led with the value of PIR, following tutorial http://www.electronicwings.com/nodemcu/pir-interfacing-with-nodemcu:
Code: Select all
int LED = D4;
int PIR_Input = D1;
void setup(){
pinMode(PIR_Input,INPUT);
pinMode(LED,OUTPUT);
}
void loop() {
digitalWrite(LED, digitalRead(PIR_Input));
}
However the builtin blue LED and my green led are blinking interchangeably (green turns on, stays for 1 sec, turns off and built-in blue turns on, stays for 1 second, turns off, green turns on. ..). Any ideas why it's behaving like that? It does not care about motion.