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")