DFRobot_Tilt_Sensor_(SKU_DFR0028) - jimaobian/DFRobotWiki GitHub Wiki
Introduction
the dfrobot tilt sensor is a digital mercury-based tilt switch that is either closed, disconnected or open. the module is based on the number of mercury switches. the mercury flows to the low-lying and could therefore be used as a simple tilt sensor. the dedicated sensor expansion boards with the Arduino, in combination, can achieve very interesting and an interactive work.
Note: Mercury is a toxic substance, please be careful to avoid breaking the glass case.
Specification
- Digital mercury-based tilt switch
- Can be used as a simple tilt sensor
Pin Definition
Touch Sensor module pin definition :
:#Input
:#Power
:#GND
Connection Diagram
Sample Code
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
}
}
shopping dfrobot tilt sensor (sku:dfr0028)
category: Product Manual category: DFR Series category: Sensors category:source category:Diagram