手势传感器 =================== .. figure:: /_static/products/ledong-module/static/图片/手势感应-H.png :width: 55% :align: center 概述 -------------------- 用于检测手势变化(向上、向下、向左、向右) 技术参数 ------------------- 工作电压: VCC 3.3V -5V 模块尺寸:24*48mm 固定安装:2个兼容塑料积木通孔 数据类型:手势数据字符串 引脚定义 ------------------- ===== ======== 引脚 定义 ===== ======== GND 地 VCC 电源 SCL I2C时钟 SDA I2C数据 ===== ======== 示例程序 ------------------- **当手掌从手势传感器上方进行上下左右移动时,掌控板OLED屏显示对应的方向。** .. code-block:: python from bluebit import Gesture gesture = Gesture() x = None from mpython import * import time while True: x = gesture.readGesture() oled.fill(0) oled.DispChar(str('方向为:'), 0, 0, 1) oled.show() if x == 'up': oled.fill(0) oled.DispChar(str('方向为:上'), 0, 0, 1) oled.show() time.sleep(0.5) if x == 'right': oled.fill(0) oled.DispChar(str('方向为:右'), 0, 0, 1) oled.show() time.sleep(0.5) if x == 'down': oled.fill(0) oled.DispChar(str('方向为:下'), 0, 0, 1) oled.show() time.sleep(0.5) if x == 'left': oled.fill(0) oled.DispChar(str('方向为:左'), 0, 0, 1) oled.show() time.sleep(0.5) .. figure:: /_static/products/ledong-module/static/examples/手势.png :width: 100% :align: center