Tilt switch module

Tilt switch module

00087
8 Items
€1.50

 

int ledPin = 13; // Connect LED to pin 13

int switcher = 3;    // Connect Tilt sensor to Pin3

void setup()

{

pinMode(ledPin, OUTPUT); // Set digital pin 13 to output mode

pinMode(switcher, INPUT); // Set digital pin 3 to input mode

}

void loop()

{

if(digitalRead(switcher)==HIGH) //Read sensor value

{

digitalWrite(ledPin, HIGH); // Turn on LED when the sensor is tilted

}

else

{

digitalWrite(ledPin, LOW); // Turn off LED when the sensor is not triggered

}

}

Type:
Tilt switch
Operating Voltage:
4V-30V
8 Items
No reviews

16 other products in the same category:

Product added to wishlist
Product added to compare.

Our website uses cookies. Cookies help to ensure the proper functioning of the website and its improvement, so the necessary cookies (technical, functional and analytical) are installed automatically. In order to personalize your Internet search experience and provide suggestions that will be relevant to you, the website also uses targeted cookies. By clicking "I agree", you agree to the installation and use of target cookies. You can revoke your consent at any time by changing the settings of your Internet browser or deleting the recorded cookies. More detailed information is provided in the cookie policy