Data Sheet
9/25/2015 GroveGesturev1.0Wiki
http://www.seeedstudio.com/wiki/Grove__Gesture_v1.0 8/10
GestureExamples/Applications
TheseexamplesaregoingtoshowyouhowtorecognizegesturesfromthisGrove-
Gesture.
OpenFile->Examples->Gesture(or:Gesture_PAJ7620)->example-
>paj7620_9gesturessketchforacompleteexample.
Description:Thisexamplecanrecognize9gesturesandoutputtheresult,including
moveup,movedown,moveleft,moveright,moveforward,movebackward,circle-
clockwise,circle-counterclockwise,andwave.YoualsocanuseGestureasaninput
devicetocontrolanothergrove,oracomputer,mobilephone,smartcar,robot,and
morewithasimpleswipeofyourhand.
Notice:WhenyouwanttorecognizetheForward/Backwardgestures,yourgestures'
reactiontimemustlessthanGES_ENTRY_TIME(0.8s).Youalsocanadjustthereaction
timeaccordingtotheactualcircumstance.
/*
Notice:WhenyouwanttorecognizetheForward/Backwardgestures,yourgestures'reactiontimemustlessthanGES_ENTRY_TIME(0.8s).
Youalsocanadjustthereactiontimeaccordingtotheactualcircumstance.
*/
#defineGES_REACTION_TIME 500 //Youcanadjustthereactiontimeaccordingtotheactualcircumstance.
#defineGES_ENTRY_TIME 800 //WhenyouwanttorecognizetheForward/Backwardgestures,yourgestures'reactiontimemustlessthanGES_ENTRY_TIME(0.8s).
#defineGES_QUIT_TIME 1000
Followingarethemainprogramusedinthedemo:
voidsetup()
{
uint8_terror=0;
Serial.begin(9600);
Serial.println("\nPAJ7620U2TESTDEMO:Recognize9gestures.");
error=paj7620Init(); //initializePaj7620registers
if(error)
{
Serial.print("INITERROR,CODE:");
Serial.println(error);
}
else
{
Serial.println("INITOK");
}
Serial.println("Pleaseinputyourgestures:\n");
}
voidloop()
{
uint8_tdata=0,data1=0,error;
error=paj7620ReadReg(0x43,1,&data); //ReadBank_0_Reg_0x43/0x44forgestureresult.
if(!error)
{
switch(data) //Whendifferentgesturesbedetected,thevariable'data'willbesettodifferentvaluesbypaj7620ReadReg(0x43,1,&data).
{
caseGES_RIGHT_FLAG:
delay(GES_ENTRY_TIME);
paj7620ReadReg(0x43,1,&data);