Introduction: How to Use TILT Sensor With LED, BUZZER and ARDUINO

About: Maker 101; Beginner and intermediate level Maker projects! You can find projects such as "How to" and "DIY" on programmable boards such as Arduino, ESP8266, ESP32 and Raspberry Pi on this channel. The projects…

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.

Step 1: Video Tutorial

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

Step 2: Circuit

TILT Sensor to Digital 2

LED to Digital 4

BUZZER to Digital 3

Step 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);  }}