Knock-sensor module
KY-031 Knock-sensor module
KY-031 Knock-sensor module
Contents 1 Picture ..................................................
Description
KY-031 Knock-sensor module
KY-031 Knock-sensor module
Contents 1 Picture ................................................................................................................................................................. 1 2 Technical data / Short description ....................................................................................................................... 1 3 Pinout ................................................................................................................................................................... 2 4 Code example Arduino ......................................................................................................................................... 2 5 Code example Raspberry Pi ................................................................................................................................. 3
Picture
Technical data / Short description
On knocks or vibrations, the contact of the two input pins are connected.
Export: 16.06.2017
Copyright by Joy-IT - Published under CC BY-NC-SA 3.0
Page 140 of 214
KY-031 Knock-sensor module
Pinout
Code example Arduino
This example will light up a LED after the sensor detected a knock or vibration. The modules KY-011, KY-016 or KY-029 can be used as an LED.
int Led = 13 ;// Declaration of the LED output pin int Sensor = 10; // Declaration of the sensor input pin int val; // Temporary variable void setup () {
pinMode (Led, OUTPUT) ; // Initialization o...
Similar Datasheet