adafruit / Adafruit_APDS9960

Arduino drivers for APDS9960 gesture sensor
Other
37 stars 45 forks source link

Proximity and gesture at the same time doesn't work #13

Closed luizfernando-webphy closed 5 years ago

luizfernando-webphy commented 5 years ago

My application needs proximity and gesture detection at the same time. I tried to combine both exemples, and it just doesn't work.

If I take the proximity threshold interruption off, after the first gesture detection, the proximity valeu begans to return a constant value.

If I hold the proximity threshold in the firmware I got no return from the readings.

This is the adapted firmware:

include "Adafruit_APDS9960.h"

Adafruit_APDS9960 apds;

define INT_PIN 3

void setup() { Serial.begin(115200);

if(!apds.begin()){ Serial.println("failed to initialize device! Please check your wiring."); } else Serial.println("Device initialized!");

//gesture mode will be entered once proximity mode senses something close apds.enableProximity(true); apds.enableGesture(true);

//apds.setProximityInterruptThreshold(0,50); //apds.enableProximityInterrupt(); //pinMode(INT_PIN, INPUT_PULLUP); }

// the loop function runs over and over again forever void loop() { //read a gesture from the device uint8_t gesture = apds.readGesture(); if(gesture == APDS9960_DOWN) Serial.println("^"); if(gesture == APDS9960_UP) Serial.println("v"); if(gesture == APDS9960_LEFT) Serial.println("x"); if(gesture == APDS9960_RIGHT) Serial.println("o"); Serial.println(apds.readProximity()); //if (!digitalRead(INT_PIN)){ // apds.clearInterrupt(); //Serial.println(apds.readProximity()); //} delay (300); }

kbowerma commented 5 years ago

I get the same results. I do not even red gestures unless I cover the sensor within 1 inch for 2 seconds. Seems like that behavior might be related.

hoffmannjan commented 5 years ago

sorry, it's not possible to achieve, you can only pick one mode diagram

maduhaime commented 3 years ago

@hoffmannjan Does Color and Proximity can work at the same time? Since there is no movement involve...