Ks0024 keyestudio Knock Sensor Module: Difference between revisions
Jump to navigation
Jump to search
Keyestudio (talk | contribs) No edit summary |
Keyestudio (talk | contribs) |
||
Line 3: | Line 3: | ||
==Introduction== | ==Introduction== | ||
This is a knock sensor module. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiment, e.g. electronic drum. | This is a knock sensor module. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiment, e.g. electronic drum. | ||
* | * Working voltage: 5V | ||
<br>[[File:Ks0024.png|500px|frameless|thumb]]<br> | <br>[[File:Ks0024.png|500px|frameless|thumb]]<br> | ||
<br> | <br> | ||
==Connection Diagram == | ==Connection Diagram == | ||
<br>[[File:Ks0024-.png|700px|frameless|thumb]]<br> | <br>[[File:Ks0024-.png|700px|frameless|thumb]]<br> |
Revision as of 15:35, 12 April 2019
Introduction
This is a knock sensor module. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiment, e.g. electronic drum.
- Working voltage: 5V
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); } }
Upload the code to the board. When the sensor detects a knock signal, both the led on the sensor and led 13 on the UNO board are turned on.
Resources
- Video
http://video.keyestudio.com/ks0024/
- PDF
https://drive.google.com/open?id=12voerfhN0VC5GShUagyO5XpwmPXDIcai