How to Use TILT Sensor With LED, BUZZER and ARDUINO

by MertArduino in Circuits > Arduino

114 Views, 0 Favorites, 0 Comments

How to Use TILT Sensor With LED, BUZZER and ARDUINO

1.png

The tilt sensor is a component that can detect the tilting of an object. However it is only the equivalent to a pushbutton activated through a different physical mechanism. This type of sensor is the environmental-friendly version of a mercury-switch. It contains a metallic ball inside that will commute the two pins of the device from on to off and viceversa if the sensor reaches a certain angle.

Video Tutorial

How to use TILT sensor with LED, BUZZER and ARDUINO

Required Hardware:

LM393 Tilt Angle Sensor - https://bit.ly/3m3FgGX

Arduino Nano V3 - http://bit.ly/2RTa3rp

LED Kit - http://bit.ly/37OajhS

5V Buzzer - http://bit.ly/33koZn5

Breadboard - http://bit.ly/30ckFoc

Jumper Wires - http://bit.ly/2MtyZCX

Circuit

circuit.png

TILT Sensor to Digital 2

LED to Digital 4

BUZZER to Digital 3

Get the Code

GitHub: https://github.com/MertArduino/How-to-use-TILT-sensor-with-LED-BUZZER-and-ARDUINO

#define TILT 2#define LED 4#define BUZZER 3void setup() {  Serial.begin(9600);  pinMode(TILT, INPUT);  pinMode(LED, OUTPUT);  pinMode(BUZZER, OUTPUT);}void loop() {  int TILT_VALUE = digitalRead(TILT);  if (TILT_VALUE == LOW){    digitalWrite(LED,HIGH);    digitalWrite(BUZZER, HIGH);    delay(1000);  }  else {    digitalWrite(LED,LOW);    digitalWrite(BUZZER, LOW);  }}