Tilt sensor(SW-520D): 두 판 사이의 차이
(Created page with "center|class=coders100 This sensor outputs a HIGH value when tilted. It is modularized, allowing for direct connection to an Arduino. The sensitivity of the tilt detection can be adjusted by manipulating the variable resistor on the product. == '''Specifications''' == * Operating Voltage: 3.3V ~ 5V == '''Required Hardware''' == * Tilt sensor * Arduino UNO * UNO Cable * M-F Cable (3 pieces) == '''Connection''' == Can be connec...") |
잔글편집 요약 없음 |
||
| (같은 사용자의 중간 판 하나는 보이지 않습니다) | |||
| 1번째 줄: | 1번째 줄: | ||
[[File:기울기대표이미지1.jpg|center|class=coders100]] | {{#seo:|title=ArduWiki: Arduino Tilt Sensor (SW-520D) Guide|title_mode=append|keywords=Arduino, Information Science, Maker Learning, Performance Evaluation, Tilt Sensor (SW-520D), Arduino Projects, Capstone Projects, Arduino Example Code|description=Introduces how to control the tilt sensor (SW-520D) with Arduino (basic information, circuit, example code). Can be used in Information Science and Maker classes.}}[[File:기울기대표이미지1.jpg|center|class=coders100]] | ||
This sensor outputs a HIGH value when tilted. | This sensor outputs a HIGH value when tilted. | ||
| 5번째 줄: | 5번째 줄: | ||
The sensitivity of the tilt detection can be adjusted by manipulating the variable resistor on the product. | The sensitivity of the tilt detection can be adjusted by manipulating the variable resistor on the product. | ||
== '''Specifications''' == | == '''Specifications''' == | ||
* Operating Voltage: 3.3V ~ 5V | * Operating Voltage: 3.3V ~ 5V | ||
== '''Required Hardware''' == | == '''Required Hardware''' == | ||
| 16번째 줄: | 18번째 줄: | ||
* UNO Cable | * UNO Cable | ||
* M-F Cable (3 pieces) | * M-F Cable (3 pieces) | ||
== '''Connection''' == | == '''Connection''' == | ||
2025년 3월 20일 (목) 19:54 기준 최신판

This sensor outputs a HIGH value when tilted.
It is modularized, allowing for direct connection to an Arduino.
The sensitivity of the tilt detection can be adjusted by manipulating the variable resistor on the product.
Specifications
- Operating Voltage: 3.3V ~ 5V
Required Hardware
- Tilt sensor
- Arduino UNO
- UNO Cable
- M-F Cable (3 pieces)
Connection
Can be connected to a digital pin other than D7.
| SW-520D | Arduino Uno |
|---|---|
| D0 | D7 |
| GND | GND |
| VCC | 5V |

Example Code
Check the execution results on the Serial Monitor. Execution video
// Define the tilt sensor pin number
#define tilt 7
void setup()
{
// Set pin 7 as INPUT
pinMode(tilt, INPUT);
// Start serial communication
Serial.begin(9600);
Serial.println("Serial start");
}
void loop()
{
if(digitalRead(tilt) == 0) // When the tilt sensor output is 0 (balanced state)
{
Serial.println("Balanced");
delay(1000);
}
else if(digitalRead(tilt) == 1) // When the tilt sensor output is 1 (tilted state)
{
Serial.println("Tilted");
delay(1000);
}
}