Hello there,
I have a program using Pir motion sensor on GrovePi coming from grovepi library and I want to use it on Grove hat, can someone help me to “convert” my script to Grove hat compatibility ?
on the wiki I note that pir sensor need to be plugged on pin 12 (gpio) instead of digital plug.
I tried to reuse the script groveminipirmotionsensor.py but its more complex.
I simply use this lines :
import time
import grovepi
pir_sensor = 8
grovepi.pinMode(pir_sensor,“INPUT”)
while True:
try:
# Sense motion, usually human, within the target range
if grovepi.digitalRead(pir_sensor):
print ‘Motion Detected’
else:
print ‘-’
Thank you in advance
Regards