CircuitPython driver for the Person Sensor by Useful Sensors.
-
Copy
person_sensor.py
into thelib
folder on your CircuitPython device. -
From the (Adafruit CircuitPython library bundle)[https://circuitpython.org/libraries], copy
adafruit_ticks.mpy
into thelib
folder on your CircuitPython device. -
In your code, initialize a
busio.I2C
instance (and make sure it's the one your Person Sensor is wired too!):
import busio
import board
# if your board has a stemma/qt connector
i2c = board.STEMMA_I2C()
# alternatively, if you're using the SDA/SCL pins:
# i2c = busio.I2C(board.SCL, board.SDA)
- Initialize a
PersonSensor
instance:
from person_sensor import PersonSensor
person_sensor = PersonSensor(i2c)
- Query the Person Sensor for detected faces:
while True:
faces = person_sensor.get_faces()
print(faces)
- Official Device Docs
- (Note that this repo is currently up to date with commit e03b5c9)
- Official CircuitPython Examples
- Alternative Library Implementation by robotastic