»óÇ°Ä«Å×°í¸® > ¼¾¼­ > ¸ð¼Ç/¿òÁ÷ÀÓ/Á¦½ºÃ³

Á¦½ºÃ³/¸ð¼Ç¼¾¼­ (Gesture Sensor) [SEN0187]
ÆǸŰ¡°Ý : 22,000¿ø (ºÎ°¡¼¼ Æ÷ÇÔ)
»óÇ°ÄÚµå : [3528]ZAS-DFR-PTW-SEN0187
¹è¼ÛÀÏ : ´çÀϹ߼Û
Á¦Á¶»ç : DFRobot
ºê·£µå : DFRobot [ºê·£µå¸ô ¹Ù·Î°¡±â]
³²Àº¼ö·® : 6°³
±¸¸Å¼ö·® :
°³
ÃÑ ±Ý¾× :
Ãß°¡&´ë·®±¸¸Å ¿äû 053-588-4080

  • »óÇ°»ó¼¼
  • °ü·Ã»óÇ°
  • ¹è¼Û/±³È¯/¹ÝÇ° ¾È³»
  • »óÇ°¸®ºä
º» ¼¾¼­´Â APDS-9960 ĨÀÌ ³»ÀåµÇ¾î À־ »ö»ó ¹× Á¦½ºÃ³¸¦ ¼¾½ÌÇÒ ¼ö ÀÖ½À´Ï´Ù. Áï, ¼ÕÀ» Èçµé¸é LED¸¦ ÄÑµç µîÀÇ ±â´ÉÀ» ±¸ÇöÇÒ ¼ö ÀÖ½À´Ï´Ù.




Sensor PinUNO Pin
VCC5V
GNDGND
SCLSCL
SDASDA
INT2

ÄÚµå ´Ù¿î·Îµå

  • Download and install the RGB and Gesture Sensor Library: 

¶óÀ̺귯¸® ´Ù¿î·Îµå: Click to download library files 

Next, we need to open the ARDUINO IDE, and copy the following simple code to the IDE window. Then select the right serial port and board (Arduino UNO). Wave your hand in front of the sensor, see what happen on the serial port.



#include

#include

 

// Pins

#define APDS9960_INT    2 // Needs to be an interrupt pin

 

APDS9960 apds = APDS9960();

int isr_flag = 0;

 

void setup() {

 

  // Initialize Serial port

  Serial.begin(9600);

  Serial.println();

  Serial.println(F("--------------------------------"));

  Serial.println(F("APDS-9960 - GestureTest"));

  Serial.println(F("--------------------------------"));

   

  // Initialize interrupt service routine

  attachInterrupt(0, interruptRoutine, FALLING);

 

  // Initialize APDS-9960 (configure I2C and initial values)

  if ( apds.init() ) {

    Serial.println(F("APDS-9960 initialization complete"));

  } else {

    Serial.println(F("Something went wrong during APDS-9960 init!"));

  }

   

  // Start running the APDS-9960 gesture sensor engine

  if ( apds.enableGestureSensor(true) ) {

    Serial.println(F("Gesture sensor is now running"));

  } else {

    Serial.println(F("Something went wrong during gesture sensor init!"));

  }

}

 

void loop() {

  if( isr_flag == 1 ) {

    handleGesture();

      if(digitalRead(APDS9960_INT) == 0){

      apds.init();

      apds.enableGestureSensor(true);

    }

 

    isr_flag = 0;

  }

}

 

void interruptRoutine() {

  isr_flag = 1;

}

 

void handleGesture() {

    if ( apds.isGestureAvailable() ) {

    switch ( apds.readGesture() ) {

      case DIR_UP:

        Serial.println("UP");

        break;

      case DIR_DOWN:

        Serial.println("DOWN");

        break;

      case DIR_LEFT:

        Serial.println("LEFT");

        break;

      case DIR_RIGHT:

        Serial.println("RIGHT");

        break;

      case DIR_NEAR:

        Serial.println("NEAR");

        break;

      case DIR_FAR:

        Serial.println("FAR");

        break;

      default:

        Serial.println("NONE");

    }

  }

}



¸ÞÄ«¸®¿öÁî






°ßÀû¿äû
±¸¸Å´ëÇà
Äü/¹æ¹®¼ö·É
ÈĺҰáÁ¦
±â¼ú¹®ÀÇ