Introduction

The DFRobot Digital Vibration Sensor is a digital plug and play vibration module. It has a digital input vibration switch module It can sense weak vibration signals, which can be used with the "shock" interaction projects or whatever fun interactive project you can create!

Product Performance:

Specification

Pin Definition

Relay module pin definition :

:#Input

:#Power

:#GND

digital input module

Connection Diagram

Digital module connection diagram

Sample Code

#define SensorLED     13
#define SensorINPUT   3  //Connect the sensor to digital Pin 3 which is Interrupts 1.

unsigned char state = 0;

void setup()
{
  pinMode(SensorLED, OUTPUT);
  pinMode(SensorINPUT, INPUT);
  attachInterrupt(1, blink, FALLING);// Trigger the blink function when the falling edge is detected

}
void loop()
{
      if(state!=0)
      {
        state = 0;
        digitalWrite(SensorLED,HIGH);
        delay(500);
      }
      else
        digitalWrite(SensorLED,LOW);
}


void blink()//Interrupts function
{
  state++;
}

More Documents

DFshopping_car1.png Get DFRobot Digital Vibration Sensor (SKU:DFR0027) from DFRobot Store or DFRobot Distributor.

Turn to the Top