具有先進的手勢檢測,接近檢測和數字環境光感應功能,是壹個采用單個8引腳封裝的數字RGB,環境光,近程和手勢傳感器。該裝置具有I2C兼容的接口,為紅色,綠色,藍色,和透明(RGBC),近程和手勢感測配有LED紅外,
APDS-9930
/Depau/APDS9930
/adafruit/Adafruit_APDS9960/zip/master
Adafruit_APDS9960 apds;
// the setup function runs once when you press reset or power the board
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);
}
// 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("v");
if(gesture == APDS9960_UP) Serial.println("^");
if(gesture == APDS9960_LEFT) Serial.println("<");
if(gesture == APDS9960_RIGHT) Serial.println(">");
}