Konubinix' opinionated web of thoughts

Testing the PIR With Micropython

Fleeting

micropython

PIR

Tested on the pico w.

The LED is very useful to find out whether the board should see something or not. It is not as simple is it seems.

This code is from memory, so maybe not ready to copy paste as-is.

import machine
import time

a=machine.ADC(machine.Pin(26))
while True:
    time.sleep(0.2)
    print(a.read_u16())

I can see the value increasing from 133 to 1000 when the LED is on.

import machine
import time

p=machine.Pin(26, machine.Pin.IN)
while True:
    time.sleep(0.2)
    print(p.value())

I can see the value moving from 0 to 1 when the LED is on.