Gesture Sensor Not Working?

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
billioncash
 
Posts: 6
Joined: Sun Jan 20, 2019 12:18 am

Gesture Sensor Not Working?

Post by billioncash »

Hello,

I'm trying to use the gesture sensor and when I run the example code:

Code: Select all

from adafruit_clue import clue

while True:
    print("Gesture: {}".format(clue.gesture))
I can only get a 0 value to return.

I'm pretty new to the Clue in general, so any help or pointing in the right direction is greatly appreciated.

Thanks!

User avatar
billioncash
 
Posts: 6
Joined: Sun Jan 20, 2019 12:18 am

Re: Gesture Sensor Not Working?

Post by billioncash »

I tested this code on my clue:

Code: Select all

from board import SCL, SDA
import busio
from adafruit_apds9960.apds9960 import APDS9960

i2c = busio.I2C(SCL, SDA)

apds = APDS9960(i2c)
apds.enable_proximity = True
apds.enable_gesture = True

# Uncomment and set the rotation if depending on how your sensor is mounted.
# apds.rotation = 270 # 270 for CLUE

while True:
    gesture = apds.gesture()

    if gesture == 0x01:
        print("up")
    elif gesture == 0x02:
        print("down")
    elif gesture == 0x03:
        print("left")
    elif gesture == 0x04:
        print("right")
and this code does work. I'm pretty confused about why the first method only produces 0, while the next method worked.

User avatar
billioncash
 
Posts: 6
Joined: Sun Jan 20, 2019 12:18 am

Re: Gesture Sensor Not Working?

Post by billioncash »

Even when I run the gesture sensor code:

Code: Select all

# SPDX-FileCopyrightText: 2019 Kattni Rembor, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
from adafruit_clue import clue

clue.sea_level_pressure = 1020

clue_data = clue.simple_text_display(title="CLUE Sensor Data!", title_scale=2)

while True:
    clue_data[0].text = "Acceleration: {:.2f} {:.2f} {:.2f} m/s^2".format(
        *clue.acceleration
    )
    clue_data[1].text = "Gyro: {:.2f} {:.2f} {:.2f} dps".format(*clue.gyro)
    clue_data[2].text = "Magnetic: {:.3f} {:.3f} {:.3f} uTesla".format(*clue.magnetic)
    clue_data[3].text = "Pressure: {:.3f} hPa".format(clue.pressure)
    clue_data[4].text = "Altitude: {:.1f} m".format(clue.altitude)
    clue_data[5].text = "Temperature: {:.1f} C".format(clue.temperature)
    clue_data[6].text = "Humidity: {:.1f} %".format(clue.humidity)
    clue_data[7].text = "Proximity: {}".format(clue.proximity)
    clue_data[8].text = "Gesture: {}".format(clue.gesture)
    clue_data[9].text = "Color: R: {} G: {} B: {} C: {}".format(*clue.color)
    clue_data[10].text = "Button A: {}".format(clue.button_a)
    clue_data[11].text = "Button B: {}".format(clue.button_b)
    clue_data[12].text = "Touch 0: {}".format(clue.touch_0)
    clue_data[13].text = "Touch 1: {}".format(clue.touch_1)
    clue_data[14].text = "Touch 2: {}".format(clue.touch_2)
    clue_data.show()
The Gesture returns 0 or no gesture detected 90% of the time.

User avatar
mikeysklar
 
Posts: 14181
Joined: Mon Aug 01, 2016 8:10 pm

Re: Gesture Sensor Not Working?

Post by mikeysklar »

Hello billioncash,

Could you try the simpletest.py from the APDS9960 repo:

https://github.com/adafruit/Adafruit_Ci ... pletest.py

Please make sure you are running the latest Circuit Python and the CP library when running this.

https://circuitpython.org/board/clue_nrf52840_express/

I did see the APD sensor being misaligned by 90 degrees in a February github issue. The issue was closed in May.

https://github.com/adafruit/Adafruit_Ci ... /issues/16
The gesture sensor is not great. It requires a learning curve involving things like moving slowly etc. I'm closing this issue as the initial report is not something that can be resolved - it is how the sensor works. I will be creating a new issue to add rotation to this library to be able to implement in the CLUE library to handle the sensor rotation.

Locked
Please be positive and constructive with your questions and comments.

Return to “CLUE Board”