Toxshot44
Published © LGPL

Clap

Uses sound electret to turn on LEDs My first uploaded project

BeginnerFull instructions provided383
Clap

Things used in this project

Hardware components

5 mm LED: Green
5 mm LED: Green
×1
Arduino Sound electret
×1
Resistor 220 ohm
Resistor 220 ohm
×2
5 mm LED: Red
5 mm LED: Red
×1

Story

Read more

Schematics

Clap

Code

Clap

Arduino
Uses electret to turn LED Red or Green according to sound level
// checks to see if there is sound and if there is turns on red light
//REM make sure you check the level on the potentiometer if it doesn't work!!

int micPin = 6;   // Mic connected to pin 6
int micVal = HIGH; //HIGH is no sound, LOW is sound



void setup ()
{
  Serial.begin(9600);  
  pinMode(12, OUTPUT); //red led for sound 
  pinMode (11, OUTPUT); // green led for silence
  pinMode (micPin, INPUT) ;   //Set pin for input
}
void loop ()
{
  micVal = digitalRead (micPin) ; // senses sound
  
  if (micVal == HIGH ) // There is sound!!!
  {
    
            Serial.println ("silence");// sends 'silence' to printer
            digitalWrite(11, HIGH);//turns on green LED
            delay (5);
            digitalWrite (11, LOW);// turns off green LED
            
      } else { Serial.println ("sound");//   sends 'sound' to prinetr
            digitalWrite(12, HIGH);//turns on red LED     
            delay (5000);
            digitalWrite (12, LOW);// turns off red LED
      }
  }

 

Credits

Toxshot44
1 project • 0 followers

Comments