Vibration Sensor Module(SW-18010P): 두 판 사이의 차이
(Created page with "{{#seo:|title=아두위키 : 아두이노 진동 센서 모듈(SW-18010P) 가이드|title_mode=append|keywords=아두이노, 정보과학, 메이커학습, 수행평가, 진동 센서 모듈(SW-18010P), 아두이노 작품, 캡스톤작품, 아두이노 예제코드|description=아두이노로 진동 센서 모듈(SW-18010P)을 제어하는 방법(기본정보, 회로, 예제 코드)을 소개합니다. 정보과학과 메이커수업에 활용가능합니다.}} File:...") |
(차이 없음)
|
2024년 3월 24일 (일) 15:21 판

The SW-18010P is a vibration sensor module that can detect shocks and vibrations. It outputs digitally and does not provide an analog output.
Specifications
- Operating Voltage [V]: 3.3 ~ 5
- Output: Digital (No analog)
Example Required Hardware
- Arduino board
- Vibration Sensor Module
- Jumper cables
- LED
Connection
| LED | Vibration Sensor | Arduino | |||
| VCC | 5V | ||||
| - | GND | GND | |||
| + | D7 | ||||
| DO | D8 | ||||

Example Code
The code turns on an LED when a vibration is detected.
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);
}
Execution Result
