# KS0114 keyestudio EASY plug Knock Sensor ![](media/wps1.png) ## 1. Introduction The knock sensor is mainly composed of SW-280 vibration switch, which is an inductive proximity switch. It is an electronic switch that transmits the sensing result to the circuit device and induces the circuit to start working when the vibration force is induced. The module comes with a positioning hole for you to fix it to other devices. You can make full use of it with creative thinking, like electronic drum, and so on. This module should be used together with EASY plug control board. **Special Note:** The sensor/module is equipped with the RJ11 6P6C interface, compatible with our keyestudio EASY plug Control Board with RJ11 6P6C interface. If you have the control board of other brands, it is also equipped with the RJ11 6P6C interface but has different internal line sequence, can’t be used compatibly with our sensor/module. ## 2. Features - Connector: Easy plug - Working voltage: 5V - Sensor type: Digital ## 3. Technical Details - Dimensions: 38mm * 20mm * 18mm - Weight: 4.4g ## 4. Connect It Up Connect the EASY Plug knock sensor and LED module to control board using RJ11 cable. Then connect the control board to your PC with a USB cable. ![](media/wps2.png) ## 5. Upload the Code Download code:[Code](./Code.7z) ```c int Led=13;//define LED interface int Shock=8;//define knock sensor interface; int val;//define digital variable val void setup() { pinMode(Led,OUTPUT);//define LED as output pinMode(Shock,INPUT);//define knock sensor as output } void loop() { val=digitalRead(Shock);//read the value of interface8 and assign it to val if(val==HIGH)//when the knock sensor detect a signal, LED will flash. { digitalWrite(Led,LOW); } else { digitalWrite(Led,HIGH); } } ``` ## 6. Result Done uploading the code, if knock the sensor hard, the led will be turned on. ![](media/wps3.png)