-->
Page 1 of 1

LED Blinking after connecting to PIR sensor

PostPosted: Sat May 26, 2018 4:10 pm
by Emre Aladag
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:
Code: Select allint 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.


Re: LED Blinking after connecting to PIR sensor

PostPosted: Thu May 30, 2019 9:43 am
by element22
Hello,

I was wondering if you ever found a solution to this problem. I am having the exact same issue and haven't been able to figure it out.

Thanks!

Re: LED Blinking after connecting to PIR sensor

PostPosted: Fri May 31, 2019 1:46 pm
by schufti
you should llok at the serial output during this situation.
most likely you get a watchdog reboot loop ?