Introduction

Discord

Driver for the PAJ7620 gesture sensor.

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing from PyPI

Note

This library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install circuitpython-paj7620

To install system-wide (this may be required in some cases):

sudo pip3 install circuitpython-paj7620

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install circuitpython-paj7620

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install paj7620

Or the following command to update an existing version:

circup update

Usage Example

sensor = paj7620.PAJ7620Gesture(i2c)
gestures = sensor.read()
print(gestures)

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Table of Contents

Simple test

Ensure your device works with this simple test.

examples/paj7620_simpletest.py
 1# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
 2# SPDX-FileCopyrightText: Copyright (c) 2022 Radomir Dopieralski
 3#
 4# SPDX-License-Identifier: Unlicense
 5import board
 6import busio
 7import paj7620
 8
 9
10i2c = busio.I2C(board.SCL, board.SDA, frequency=400_000)
11sensor = paj7620.PAJ7620Gesture(i2c)
12
13while True:
14    time.sleep(1)
15    gesture = sensor.read()
16    print(gesture)
17    if gesture & paj7620.UP:
18        print("up")
19    if gesture & paj7620.DOWN:
20        print("down")
21    if gesture & paj7620.LEFT:
22        print("left")
23    if gesture & paj7620.RIGHT:
24        print("right")
25    if gesture & paj7620.NEAR:
26        print("near")
27    if gesture & paj7620.FAR:
28        print("far")
29    if gesture & paj7620.CW:
30        print("cw")
31    if gesture & paj7620.CCW:
32        print("ccw")
33    if gesture & paj7620.WAVE:
34        print("wave")

paj7620

Driver for the PAJ7620 gesture sensor.

  • Author(s): Radomir Dopieralski

Implementation Notes

Hardware:

Software and Dependencies:

class paj7620.PAJ7620Gesture(i2c, addr=115)

Gesture sensor.

read()

Read and clear the gestures from the sensor.

Indices and tables