KY-031 Percussion Knock Sensor Module / Knocking Sensor / KY031

LKR 110.00

15 in stock

Description

Both knock sensor module and digital interface 13 carries LED for the build-up of a simple circuit and a knock flasher.

Connect knock sensor to digital interface 3 with the LED carried by digital interface 13. When knock sensor detects a knock signal, the LED will flash.

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 as output interface
pinMode(Shock,INPUT);//define knock sensor as output interface
}
void loop()
{
val=digitalRead(Shock);//read and assign the value of digital interface 3 to val
if(val==HIGH)//When knock sensor detects any signal , the LED will flash
{ digitalWrite(Led,LOW);
}e
lse
{ digitalWrite(Led,HIGH);
}}

Reviews

There are no reviews yet.

Be the first to review “KY-031 Percussion Knock Sensor Module / Knocking Sensor / KY031”