Vibration switch module (KY-002) [S039]



https://www.youtube.com/watch?v=W7pKNvCRH4w


*GitHub : https://github.com/rdiot/rdiot-s039.git


* Specs

This switch is OFF in the resting state, when the external force to touch and to achieve a proper vibration, meet the appropriate speed or from the (partial) heart, conductive pin will momentarily conduction (ON) status, make changes in electric property, and disappear when the external force electric property open (OFF) state is restored

Omnidirectional, any Angle can trigger job

Component model: SW-18015P



* Contents

- Connect

S ----- D2

middle ----- 5V

- ----- GND

 

- Key Code

int pin = 2;

int vibration = digitalRead(pin);


  if(vibration == LOW)

  {

    lcd.setCursor(0,2);

    lcd.print("vibration=detected");

    delay(100);

  }

  else{

    lcd.setCursor(0,2);

    lcd.print("vibration=NONE    ");

  }

Posted by RDIoT
|