本次活动使用的手势传感器如下,为5v的iic接口。
在DEV-12640也就是我们用的开发板中,支持iic的接口,
说干就干,焊接组装
硬件连接完成后,连接如下:
传感器电源---vcc 5v
传感器GND----GND
传感器SCL----D3
传感器SDA---D2
在arduio ide中安装7620的库,步骤如下:
安装完成之后,打开例程,
可以完成对应手势的获取。
手势定义如下;为了减少字符的打印,清除调试打印信息,如下:
从定义中可以可以看出,有上,下,左右,顺时针 逆时针,靠近 ,远离等姿势。
typedef enum{ eGestureNone = 0x00, /**< no gestures detected */ eGestureRight = 0x01<<0, /**< move from left to right */ eGestureLeft = 0x01<<1, /**< move from right to left */ eGestureUp = 0x01<<2, /**< move from down to up */ eGestureDown = 0x01<<3, /**< move form up to down */ eGestureForward = 0x01<<4, /**< starts far, move close to sensor */ eGestureBackward = 0x01<<5, /**< starts near, move far to sensor */ eGestureClockwise = 0x01<<6, /**< clockwise */ eGestureAntiClockwise = 0x01<<7, /**< anti-clockwise */ eGestureWave = 0x01<<8, /**< wave quickly */ eGestureWaveSlowlyDisorder = 0x01<<9, /**< wave randomly and slowly */ eGestureWaveSlowlyLeftRight = eGestureLeft + eGestureRight, /**< slowly move left and right */ eGestureWaveSlowlyUpDown = eGestureUp + eGestureDown, /**< slowly move up and down */ eGestureWaveSlowlyForwardBackward = eGestureForward + eGestureBackward, /**< slowly move forward and backward */ eGestureAll = 0xff /**< support all gestures, no practical meaning, only suitable for writing abstract program logic. */ }eGesture_t;