Tilt Switch Module (KY-020) [S050]
https://www.youtube.com/watch?v=dVq5xSTB9S8
*GitHub : https://github.com/rdiot/rdiot-s050.git
* Specs
Tilt sensor
Working voltage: 3.3V~5V
Digital Switch Output (0 & 1)
High sensitivity
With fixed bolt hole for easy installation
Works with Official Arduino Boards
Forum link: https://www.facebook.com/123Neonado
Material: PCB
Dimensions: 25 x 16 x 8 mm / 0.98 x 0.63 x 0.31 inch
Weight: 1 g / 0.04 oz
Color: Black
* Contents
- Connect
S ----- D2
middle ----- 5V
- ----- GND
- Key Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // LCD2004
int pin = 2;
int val = digitalRead(pin);
if(val == LOW)
{
lcd.setCursor(0,2);
lcd.print("Tilt CLOSE");
}
else
{
lcd.setCursor(0,2);
lcd.print("Tilt OPEN ");
}
'2) Sensor > Tilt' 카테고리의 다른 글
RPI-1031 Angle Sensor Four Direction Sensor (RPI-1031) [S183] (0) | 2016.09.08 |
---|---|
Mini Mercury Switch Module (KY-017) [S049] (0) | 2016.09.08 |
Tilt SW-520D Sensor (SW-520D) [S067] (0) | 2016.09.08 |
Tilt SW-200D Sensor (W-200D) [S051] (0) | 2016.09.08 |