“Sensor-Gesture/zh”的版本间的差异
(→图库) |
502748957@qq.com(讨论 | 贡献) (→开发) |
||
(未显示4个用户的10个中间版本) | |||
第1行: | 第1行: | ||
− | {{Language| | + | {{Language|Sensor-Gesture }} |
{| style="width: 1000px;" | {| style="width: 1000px;" | ||
| | | | ||
| | | | ||
− | [[File:Microduino-Gesture.jpg|400px|thumb|right| | + | [[File:Microduino-Gesture.jpg|400px|thumb|right|Sensor-Gesture]] |
− | + | Sensor-Gesture产品编号:'''MSDI81''' | |
− | |||
− | |||
− | |||
− | |||
+ | Sensor-Gesture是手势传感器,可以检测手的运动方向和远近程度 | ||
==传感器引脚说明== | ==传感器引脚说明== | ||
{{Sensor_explain | {{Sensor_explain | ||
|nameA=[[Sensor-Gesture/zh]] | |nameA=[[Sensor-Gesture/zh]] | ||
− | |modeA= | + | |modeA=SDA |
− | |modeB= | + | |modeB=SCL |
}} | }} | ||
==特色== | ==特色== | ||
+ | *采用APDS9960传感器,IIC通讯 | ||
*检测灵敏度高,稳定性好 | *检测灵敏度高,稳定性好 | ||
− | * | + | *体积小,易安装 |
第31行: | 第29行: | ||
**板子大小:23.5mm*13mm | **板子大小:23.5mm*13mm | ||
**1.27mm间距的4Pin接口与sensorhub相连 | **1.27mm间距的4Pin接口与sensorhub相连 | ||
− | **传感器CAD图纸:'''[[File:Sensor_CAD. | + | **传感器CAD图纸:'''[[File:Sensor_CAD.pdf]]''' |
*功能描述 | *功能描述 | ||
− | ** | + | **本传感器可检测手的运动方向和远近程度 |
− | ** | + | **本传感器可检测环境光和RGB颜色色度 |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
*接法 | *接法 | ||
− | ** | + | **本传感器可连接到核心的I2C接口 |
− | |||
− | |||
− | |||
− | |||
==开发== | ==开发== | ||
===程序下载=== | ===程序下载=== | ||
− | + | 复制如下程序至Microduino IDE中,可以测试手势检测功能是否正常。 | |
+ | 使用时正对传感器,做出标准的向左、向右、向上、向下的挥手动作,观察串口返回值 | ||
+ | <source lang="cpp"> | ||
+ | #include <Microduino_Gesture.h> | ||
+ | |||
+ | // Global Variables | ||
+ | Gesture gestureSensor; | ||
+ | |||
+ | void setup() { | ||
+ | // Initialize Serial port | ||
+ | Serial.begin(9600); | ||
+ | |||
+ | // Initialize Gesture (configure I2C and initial values) | ||
+ | if ( gestureSensor.begin() ) { | ||
+ | Serial.println(F("Gesture initialization complete")); | ||
+ | } else { | ||
+ | Serial.println(F("Something went wrong during Gesture init!")); | ||
+ | } | ||
+ | |||
+ | if (gestureSensor.setGestureGain(GGAIN_2X)) { //GGAIN_1X GGAIN_2X GGAIN_4X GGAIN_8X | ||
+ | Serial.println(F("Gesture setGestureGain complete")); | ||
+ | } else { | ||
+ | Serial.println(F("Something went wrong during APDS-9960 setGestureGain!")); | ||
+ | } | ||
+ | |||
+ | // Start running the Gesture gesture sensor engine | ||
+ | if ( gestureSensor.enableGestureSensor(true) ) { | ||
+ | Serial.println(F("Gesture sensor is now running")); | ||
+ | } else { | ||
+ | Serial.println(F("Something went wrong during gesture sensor init!")); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | if ( gestureSensor.isGestureAvailable() ) { | ||
+ | switch ( gestureSensor.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"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
===程序烧写=== | ===程序烧写=== | ||
第59行: | 第106行: | ||
|nameB=[[Microduino-USBTTL/zh]] | |nameB=[[Microduino-USBTTL/zh]] | ||
|boardName=Microduino/mCookie-Core(328p)、Atmega328P@16M,5V | |boardName=Microduino/mCookie-Core(328p)、Atmega328P@16M,5V | ||
− | |fileName= | + | |fileName=Sensor-Gesture Test.ino |
}} | }} | ||
===硬件搭建=== | ===硬件搭建=== | ||
− | *参考下图将Sensor- | + | *参考下图将Sensor-Gesture传感器连接'''[[Microduino-Sensorhub/zh]]'''的IIC接口 |
<br> | <br> | ||
− | [[file:Microduino- | + | [[file:Microduino-sensorhub_I2C.JPG|thumb|400px|left]] |
<br style="clear: left"/> | <br style="clear: left"/> | ||
===效果观察=== | ===效果观察=== | ||
*下载完毕后,打开串口监视器 | *下载完毕后,打开串口监视器 | ||
− | * | + | *手对着传感器上下左右运动,串口监视器会打印出对应的方向,例如UP,DOWN,FAR |
− | + | ||
− | |||
==应用== | ==应用== | ||
− | * | + | *适用于手势控制系统 |
− | + | ==项目== | |
==购买== | ==购买== | ||
− | |||
==图库== | ==图库== |
2018年11月15日 (四) 10:10的最新版本
Language | English |
---|
Sensor-Gesture产品编号:MSDI81 Sensor-Gesture是手势传感器,可以检测手的运动方向和远近程度 传感器引脚说明
特色
规格
开发程序下载复制如下程序至Microduino IDE中,可以测试手势检测功能是否正常。 使用时正对传感器,做出标准的向左、向右、向上、向下的挥手动作,观察串口返回值 #include <Microduino_Gesture.h>
// Global Variables
Gesture gestureSensor;
void setup() {
// Initialize Serial port
Serial.begin(9600);
// Initialize Gesture (configure I2C and initial values)
if ( gestureSensor.begin() ) {
Serial.println(F("Gesture initialization complete"));
} else {
Serial.println(F("Something went wrong during Gesture init!"));
}
if (gestureSensor.setGestureGain(GGAIN_2X)) { //GGAIN_1X GGAIN_2X GGAIN_4X GGAIN_8X
Serial.println(F("Gesture setGestureGain complete"));
} else {
Serial.println(F("Something went wrong during APDS-9960 setGestureGain!"));
}
// Start running the Gesture gesture sensor engine
if ( gestureSensor.enableGestureSensor(true) ) {
Serial.println(F("Gesture sensor is now running"));
} else {
Serial.println(F("Something went wrong during gesture sensor init!"));
}
}
void loop() {
if ( gestureSensor.isGestureAvailable() ) {
switch ( gestureSensor.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");
}
}
}
程序烧写
硬件搭建
效果观察
应用
项目购买图库 |