6xKY-020 Tilt Switch Module for AVR PIC
- Our Wholesale Price includes Shipping & Handling Charges and GST
- Processing time12 ~ 20 days
- Country Of OriginChina
- Quantity
- Available
- SKU19628456
Product Description
Description:
KY-020 Tilt Switch Module for AVR PIC
Tilt switch module and digital 13 interface with built-in LED to build a simple circuit and make tilt indicator light.
Use the LED of the digital 13 interface to connect the tilt switch sensor to the digital 3 interface. When the tilt switch sensor senses a key signal, the LED is on, and vice versa.
Material: PCB
Size: 24 x 15 x 7mm
Specification:
Routines source code:
int Led = 13 ;// define LED Interface
int buttonpin = 3; // define the tilt switch sensor interfaces
int val ;// define numeric variables val
void setup()
{
pinMode(Led, OUTPUT) ;// define LED as output interface
pinMode(buttonpin, INPUT) ;// define the output interface tilt switch sensor
}
void loop ()
{
val = digitalRead(buttonpin) ;// digital interface will be assigned a value of 3 to read val
if(val == HIGH) // When the tilt sensor detects a signal when the switch, LED flashes
{
digitalWrite(Led, HIGH);
}
else
{
digitalWrite(Led, LOW);
}
}
Package Includes:
1 Piece KY-020 Tilt Switch Module(6 Pack)
Note:
Color maybe slightly different due to different monitor.
The above size is measured by hand, please allow slightly difference. Thanks !