DFRobot_Tilt_Sensor__SKU_DFR0028_-DFRobot

Introduction

The DFRobot Tilt Sensor is a digital mercury-based tilt switch that is either closed, disconnected or open. The module is based on a series of mercury switches. The mercury flows to the low-lying pressure and could therefore be used as a simple tilt sensor. in combination with our dedicated Arduino sensor expansion boards , this sensor can be used in any interactive project with easy plug and play features!

warning_yellow.png NOTE: Mercury is a toxic substance, please be careful to avoid breaking the glass case.

Specification

Pin Definition

Touch Sensor module pin definition :

1.Input

2.Power

3.GND

digital input module

Connection Diagram

Digital module 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
     }
}

More Documents

DFshopping_car1.png Get DFRobot Tilt Sensor (SKU:DFR0028) from DFRobot Store or DFRobot Distributor.

Turn to the Top