help me how to make clap clap off and single clap off for relay with arduino uno

please anyone know code and circuits for make clap clap off and single clap off with arduino.... i use relay module....

Hui, You need a microphone and amplifier and maybe also a comparator.

There are small modules like THIS: that would work. Yoiu can adjust the sensitivity with the potentiometer and get a digital output you can sense with Arduino. You need to write a software sketch that counts the sound peaks.

Simple relays like THIS: would work for most things.

DISCLAIMER: Mentioned stuff from my own shop...

You probably need some toggle code somewhat like below.

//zoomkat servo-LED button toggle test 11-12-2012

#include <Servo.h>
int button = 5; //button pin, connect to ground to move servo
int press = 0;
Servo servo;
boolean toggle = true;

void setup()
{
  Serial.begin(9600);
  Serial.println("zoomkat servo-LED button toggle test 11-12-2012");
  pinMode(13, OUTPUT); //LED on pin 13
  pinMode(button, INPUT); //arduino monitor pin state
  servo.attach(7); //pin for servo control signal
  digitalWrite(5, HIGH); //enable pullups to make pin high
}

void loop()
{
  press = digitalRead(button);
  if (press == LOW)
  {
    if(toggle)
    {
      digitalWrite(13, HIGH);   // set the LED on
      Serial.println("LED on");
      servo.write(160);
      toggle = !toggle;
    }
    else
    {
      digitalWrite(13, LOW);    // set the LED off
      Serial.println("LED off");
      servo.write(20);
      toggle = !toggle;
    }
  }
  delay(500);  //delay button for debounce
}