Why y nodemcu code for PIR is not working?

if you have a multimeter check the sensor voltage from the PIR?
have to tried changing the sensitivity?
I usually set both about the center

I dont have a multimeter but I have tried switching the sensitivity on both side of the spectrum to no avail :frowning: ....

Ok strange thing, I totally detached the PIR from the breadboard and the monitor keeps printing motion detected??? detachint the usb plug and reattaching stopped it .

I loaded the code into elegoo mega 2560 , I have the same results that I have on the nodemcu ...

What can be the issue? Also with the mainboard if I detach the sensor and the led it keeps registering movement detected.

It is probably that the "hold time" is set too high. Once it is triggered, it stays triggered until a timeout which can be many minutes later. See these instructions: https://cdn-reichelt.de/documents/datenblatt/A300/SEN-HC-SR501-MANUAL-23.09.2020.pdf

I set it to the minimum counterclock wise .

if you connect pin 13 low does it display "Motion absent!" and high "Motion detected!"?

Try not to place the sensor and the NOdeMCU close to each other. Because I have heard before some users complaining about PIR interrupting with the inner circuitry of NodeMCU.

Looks like you are physically connecting to pins 6 and 7 but your code has nothing to do with it.

what do you mean?

This ^^^

And why don't correspond to the nodemcu pins?

Here is some further technical information on the HC SR-501 PIR detector: Chinese electronics products tested (124 tests): HC-SR501 motion sensor tested
It has a 3.3v regulator on board and should be powered at >4.5 volts. You appear to be using 3.3 volts.

We've been through that. See post #8 .

I was thinkingthe same but on several guides I saw ppl using 3v3 ... and also used on the mega 2560 using the 5v5 and get the same results.

You can check this tutorial too. This is based on ESP32. But it will work even if you are using ESP8266. This is quite detailed. You can cross check your code and circuit with this one: Motion Detection with ESP32 & PIR Sensor - The Engineering Projects

I have ESP32 DevKitC NodeMCU, if it says G2 on the board it means pin 2, if it says G14 on the board it means pin 14. If this is true and that board is different like that, I dont want it anywhere near my projects ))

I have nodemcu Amica V2 ESP8266 12-F

Thanks, adding it to my black list!

BTW, try making LED flash first (try blink sketch on your selected pin) then try LED and sensor without the board. If all works then you can start debugging the input

Also, the picture supplied by @horace in post #16 does not match exactly your version of this PIR detector.
The jumper block on the opposite side to the ones illustrated in your own picture.
Anyway, if the jumper is still set as in your picture in post #15, change it so the device is in "retrigger" mode.
This should give multiple pulses during a session if there is a new detection.