In this Illustration we will going to wire the mercury switch module is a family of the tilt switching sensor, and it has an on-board LED as indicator as power status it can be used to build a simple circuit
How to use the TILT switch using Arduino.
Arduino Source Code
int tilt =2;
digitalWrite(led,LOW);//turn off the LED
digitalWrite(led,HIGH);//turn on the LED
Download the source code here | 14Core_Tilt_Switch