This message was posted on behalf of Intel Corporation
Thank you for contacting us.
I just tested your code with the PIR motion sensor that we have here, and it works fine. The difference is that I'm using the Arduino Breakout board because it supports 5V in its GPIOs.
So, I think that's the issue that you are having, if you are connecting your sensor to 5V it will generate and output signal of 5V, and it can damage your board, because it supports to 1.8V.
Personally, my recommendation is to use level shifter to avoid this issue. If the problem persist, please try it on another pin.
I hope you find this helpful.