GestureSensor.isGestureAvailable()
GestureSensor.isGestureAvailable()
描述 检查手势感应是否可用,检测是否做出手势 参数 无 返回值 无 示例 #include <Microduino_Gesture.h>
// Global Variables
Gesture gestureSensor;
void setup() {
// Initialize Serial port
Serial.begin(9600);
// Initialize Gesture (configure I2C and initial values)
if ( gestureSensor.begin() ) {
Serial.println(F("Gesture initialization complete"));
} else {
Serial.println(F("Something went wrong during Gesture init!"));
}
if (gestureSensor.setGestureGain(GGAIN_2X)) { //GGAIN_1X GGAIN_2X GGAIN_4X GGAIN_8X
Serial.println(F("Gesture setGestureGain complete"));
} else {
Serial.println(F("Something went wrong during APDS-9960 setGestureGain!"));
}
// Start running the Gesture gesture sensor engine
if ( gestureSensor.enableGestureSensor(true) ) {
Serial.println(F("Gesture sensor is now running"));
} else {
Serial.println(F("Something went wrong during gesture sensor init!"));
}
}
void loop() {
if ( gestureSensor.isGestureAvailable() ) {
Serial.println("OK!");}
}
其他 |