Sound Sensor + Arduino + Clap(ON/OFF)

1,707

11

3

Introduction: Sound Sensor + Arduino + Clap(ON/OFF)

1. Sound Sensor INPUT

analog input, A0

2. LED OUT

digital output, PIN 3

3. Code

int LED = 3;

void setup(){

pinMode (LED, OUTPUT);

}

void loop() {

int statusSensor = analogRead(A0);

if (statusSensor > 200){

delay(100);

while(true){

digitalWrite(LED, HIGH);

int statusSensor = analogRead(A0);

if(statusSensor>200){

break;

}

}

delay(100);

}

else{

digitalWrite(LED, LOW);

}

}

Be the First to Share

    Recommendations

    • Pi Day Speed Challenge

      Pi Day Speed Challenge
    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Microcontroller Contest

      Microcontroller Contest

    3 Comments

    0
    baudot
    baudot

    4 years ago

    What model sound sensor are you using?

    0
    DAEHWANL
    DAEHWANL

    Reply 4 years ago

    I used a old model.

    Now, following site sells new model.

    https://www.dfrobot.com/index.php?route=product/product&product_id=83

    0
    Swansong
    Swansong

    4 years ago

    That's a fun setup :)