Vibration Sensor Module(SW-18010P) CN: 두 판 사이의 차이
(새 문서: {{#seo:|title=ArduWiki : Arduino 振动传感器模块(SW-18010P)指南|title_mode=append|keywords=Arduino, 信息科学, 创客学习, 绩效评估, 振动传感器模块 (SW-18010P), Arduino作品, 毕业设计, Arduino示例代码|description=介绍如何使用Arduino控制振动传感器模块(SW-18010P)(基础信息、电路连接、示例代码)。适用于信息科学与创客课程。}}가운데|class=coders100 这...) |
잔글 (→连接方式) |
||
| 20번째 줄: | 20번째 줄: | ||
{| class="wikitable" | {| class="wikitable" | ||
| LED | | LED | ||
| 振动传感器 | | 振动传感器 | ||
| Arduino | | Arduino | ||
|- | |- | ||
| | | | ||
| VCC | | VCC | ||
| 5V | | 5V | ||
|- | |- | ||
| - | | - | ||
| GND | | GND | ||
| GND | | GND | ||
|- | |- | ||
| + | | + | ||
| | | | ||
| D7 | | D7 | ||
|- | |- | ||
| | | | ||
| DO | | DO | ||
| D8 | | D8 | ||
|} | |} | ||
2025년 3월 27일 (목) 15:40 기준 최신판

这是一个可以检测震动或冲击的模块。
该模块仅输出数字信号,不支持模拟输出。
规格参数
- 工作电压 [V]:3.3 ~ 5
- 输出:数字(不支持模拟)
示例所需硬件
- Arduino board
- 振动传感器模块
- 杜邦线
- LED
连接方式
| LED | 振动传感器 | Arduino |
| VCC | 5V | |
| - | GND | GND |
| + | D7 | |
| DO | D8 |

示例代码
当检测到震动时点亮LED的代码。
int led = 7;
int sensor = 8;
void setup(){
pinMode(led, OUTPUT);
pinMode(sensor, INPUT);
digitalWrite(led, LOW);
}
void loop(){
int a = digitalRead(sensor);
if(a==LOW) digitalWrite(led, HIGH);
else digitalWrite(led,LOW);
}
执行结果
