Ks0024 keyestudio Knock Sensor Module: Difference between revisions
Jump to navigation
Jump to search
PDF
Keyestudio (talk | contribs) |
Keyestudio (talk | contribs) |
||
Line 13: | Line 13: | ||
==Sample Code == | ==Sample Code == | ||
<pre> | <pre> | ||
int Led=13;//define LED interface | int Led=13;//define LED interface | ||
int Shock=3//define knock sensor interface | int Shock=3;//define knock sensor interface | ||
int val;//define digital variable val | |||
void setup() | void setup() | ||
{ | { | ||
Line 34: | Line 33: | ||
{ | { | ||
digitalWrite(Led,HIGH); | digitalWrite(Led,HIGH); | ||
}</pre> | } | ||
} | |||
</pre> | |||
==Resources == | ==Resources == |
Revision as of 16:43, 11 June 2018
Introduction
This module is a knock sensor. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiments, e.g. electronic drum.
Specification
- Working Voltage: 5V
- Size: 30*20mm
- Weight: 3g
Connection Diagram
Sample Code
int Led=13;//define LED interface int Shock=3;//define knock sensor interface int val;//define digital variable val void setup() { pinMode(Led,OUTPUT);//define LED to be output interface pinMode(Shock,INPUT);//define knock sensor to be output interface } void loop() { val=digitalRead(Shock);//read the value of interface3 and evaluate it to val if(val==HIGH)//when the knock sensor detect a signal, LED will be flashing { digitalWrite(Led,LOW); } else { digitalWrite(Led,HIGH); } }
Resources
Video
http://www.keyestudio.com/wp/ks0024-knock-sensor/
https://drive.google.com/open?id=12voerfhN0VC5GShUagyO5XpwmPXDIcai
Get One Now
Official Website
http://www.keyestudio.com/keyestudio-knock-sensor-module.html