Clap Circuit
Clap Circuit with microphone using Arduino Uno
You Tube: Video
Circuit:
Code:
int clap = 2;
int led = 13;
int val = 0;
int valold = 0;
int state = 0;
void setup() {
pinMode(clap, INPUT);
pinMode(led, OUTPUT);
}
void loop() {
val = digitalRead(clap);
if((val == HIGH) && (valold == LOW)) {
state = 1- state;
delay(10);
}
valold = val;
if (state == 1) {
digitalWrite(led, HIGH);
}
else {
digitalWrite(led, LOW);
}
}
Comments
Post a Comment