-40%
KY-020 Tilt Switch Module For AVR PIC
$ 3
- Description
- Size Guide
Description
KY-020 Tilt Switch Module For AVR PICDescription:
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
Note:
Color maybe slightly different due to different monitor.
The above size is measured by hand, please allow slightly difference. Thanks !
Shipping And Handling Policy
The buyer is responsible for any applicable import duties and local taxes. Please verify with your customs before making your purchase.
Please verify your address during checkout. We are not responsible for any wrong or undeliverable addresses.
People always bought together with