background image

9/25/2015

Grove ­ Gesture v1.0 ­ Wiki

http://www.seeedstudio.com/wiki/Grove_­_Gesture_v1.0

7/10

void

 

setup

()

{

  paj7620Init

()

;

}

This initialization code should be added to each demo.

2. Read data from PAJ7620 register via I2C

paj7620ReadReg(uint8_t addr, uint8_t qty, uint8_t data[])

addr: Register address
qty: Number of data to read, addr continuously increase.
data[]: The starting address(a variable or array) to store data.

void

 

loop

()

{

 

uint8_t data 

=

 

0

;

  

// Read Bank_0_Reg_0x43/0x44 for gesture result.

 

 

paj7620ReadReg

(

0x43

1

&

data

)

;

  

// When different gestures be detected, the variable 'data' will be set to different values by paj7620ReadReg(0x43, 1, &data).

 

 

if

 

(

data 

==

 GES_UP_FLAG

)

  

 

 

 

 

 

 

// When up gesture be detected,the variable 'data' will be set to GES_UP_FLAG.

 

 

digitalWrite

(

4

HIGH

)

;

    

 

 

 

        

// turn the LED on (HIGH is the voltage level)

 

if

 

(

data 

==

 GES_DOWN_FLAG

)

  

 

 

 

 

 

// When down gesture be detected,the variable 'data' will be set to GES_DOWN_FLAG.

        

digitalWrite

(

4

LOW

)

;

     

 

 

 

    

// turn the LED off by making the voltage LOW

}

We define some register data of gesture, refer to the following table.

Gesture

Register Data

Register

Address

If Yes

If Not

Up

data==GES_UP_FLAG

0x43

Gesture
detected

No gesture
detected

Down

data==GES_DOWN_FLAG

Left

data==GES_LEFT_FLAG

Right

data==GES_RIGHT_FLAG

Forward

data==GES_FORWARD_FLAG

Backward

data==GES_BACKWARD_FLAG

Clockwise

data==GES_CLOCKWISE_FLAG

Count
Clockwise

data==GES_COUNT_CLOCKWISE_FLAG

Wave

data==GES_WAVE_FLAG

0x44

Содержание PAJ7620U2

Страница 1: ...9 25 2015 Grove Gesture v1 0 Wiki http www seeedstudio com wiki Grove_ _Gesture_v1 0 1 10 Grove Gesture v1 0 From Wiki 来自痴汉的爱 Contents 1 Introduction 2 Features 3 Specification ...

Страница 2: ...mples Applications 5 Resources Introduction The sensor on Grove Gesture is PAJ7620U2 that integrates gesture recognition function with general I2C interface into a single chip It can recognize 9 basic gestures and these gestures information can be simply accessed via the I2C bus Application You can use Gesture as an input device to control another grove or a computer mobile phone smart car robot a...

Страница 3: ...stall Arduino driver http www seeedstudio com wiki Download_Arduino_and_install_Arduino_driver Getting Started with Seeeduino Arduino http www seeedstudio com wiki Getting_Started_with_Seeeduino Hardware Installation Grove products have a eco system and all have a same connector which can plug onto the Base Shield http www seeedstudio com wiki index php title Base_shield_v2 uselang en Connect this...

Страница 4: ...9 25 2015 Grove Gesture v1 0 Wiki http www seeedstudio com wiki Grove_ _Gesture_v1 0 4 10 Plug Grove Gesture onto the I2C port of Base shield Then plug Base shield onto the Arduino UNO ...

Страница 5: ...Setup 1 Download the library code as a zip file from the Gesture_PAJ7620 github page https github com Seeed Studio Gesture_PAJ7620 2 Unzip the downloaded file into your arduino libraries 3 Rename the unzipped folder Gesture or Gesture_PAJ7620 4 Start the Arduino IDE or restart if it is open Simple Demo The following simple demo will show you a very easy application When you move up the red led wil...

Страница 6: ... be set to different v if data GES_UP_FLAG When up gesture be detected the vari digitalWrite 4 HIGH turn the LED on HIGH is the voltage level if data GES_DOWN_FLAG When down gesture be detected the variable digitalWrite 4 LOW turn the LED off by making the voltage LOW Description of functions These are the most important useful function in the library we invite you to look at the h and cpp files y...

Страница 7: ...ures be detected the variable data will be set to diffe if data GES_UP_FLAG When up gesture be detected th digitalWrite 4 HIGH turn the LED on HIGH is the voltage l if data GES_DOWN_FLAG When down gesture be detected the vari digitalWrite 4 LOW turn the LED off by making the voltage LOW We define some register data of gesture refer to the following table Gesture Register Data Register Address If Y...

Страница 8: ...tion time according to the actual circumstance Notice When you want to recognize the Forward Backward gestures your gestures reaction time must less than GES_ENTRY_T You also can adjust the reaction time according to the actual circumstance define GES_REACTION_TIME 500 You can adjust the reaction time according to the actual circumstance define GES_ENTRY_TIME 800 When you want to recognize the For...

Страница 9: ...S_QUIT_TIME else Serial println Left break case GES_UP_FLAG delay GES_ENTRY_TIME paj7620ReadReg 0x43 1 data if data GES_FORWARD_FLAG Serial println Forward delay GES_QUIT_TIME else if data GES_BACKWARD_FLAG Serial println Backward delay GES_QUIT_TIME else Serial println Up break case GES_DOWN_FLAG delay GES_ENTRY_TIME paj7620ReadReg 0x43 1 data if data GES_FORWARD_FLAG Serial println Forward delay...

Страница 10: ...d of a single gesture to realise one function welcome to share Resources Grove Gesture_v1 0 sch pcb zip http www seeedstudio com wiki File Grove_ _Gesture_v1 0_sch_pcb zip PAJ7620U2_Datasheet_V0 8_20140611 pdf http www seeedstudio com wiki File PAJ7620U2_Datasheet_V0 8_20140611 pdf Library Grove Guesture https github com Seeed Studio Gesture_PAJ7620 Retrieved from http www seeedstudio com wiki ind...

Отзывы: