sparkfun ZX Distance and Gesture Sensor Hook-Up Manual page 13

Table of Contents

Advertisement

// Clear the interrupt flag
    interrupt_flag = false;
// You MUST read the STATUS register to clear interrupt!
    zx_sensor.clearInterrupt();
// Read last gesture
    gesture = zx_sensor.readGesture();
    gesture_speed = zx_sensor.readGestureSpeed();
switch ( gesture ) {
case NO_GESTURE:
        Serial.println("No Gesture");
break;
case RIGHT_SWIPE:
        Serial.print("Right Swipe. Speed: ");
        Serial.println(gesture_speed, DEC);
break;
case LEFT_SWIPE:
        Serial.print("Left Swipe. Speed: ");
        Serial.println(gesture_speed, DEC);
break;
case UP_SWIPE:
        Serial.print("Up Swipe. Speed: ");
        Serial.println(gesture_speed, DEC);
break;
      default: 
break;
    } 
  } 
void interruptRoutine() {
  interrupt_flag = true;
Run
Upload the sketch, and open the Serial Monitor. You should see a message
stating that initialization is complete.
Start with your hand off to one side (a "side" being the one of the infrared
LEDs with the brass covers) about 4 to 10 inches (10 to 25 cm) above the
sensor. Swipe your hand horizontally across the sensor so that your hand
passes over the one infrared LED and then the next infrared LED.
Page 13 of 16

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ZX Distance and Gesture Sensor and is the answer not in the manual?

Subscribe to Our Youtube Channel

Related Products for sparkfun ZX Distance and Gesture Sensor

This manual is also suitable for:

Sen-13162

Table of Contents