Arduino Clapswitch LAMP

2,057

36

1

Posted

Introduction: Arduino Clapswitch LAMP

PLEASE VOTE! ME IF YOU LIKE IT

Hi, This is my new Arduino clapswitch lamp. This works as a Night-Light or an Emergency Lamp. It is powered by an 9v adapter. This lamp is very useful in our daily life and easy transportation. Double clap to turn-on and again double clap to turn-off. It runs with an single led but it gives more light.

Step 1: ​YOU WILL NEED:

1.a plastic cylindrical box(optional)

2. a brighter led

3.a 9v adapter or an usb cable or battery

4.arduino board

5.mic

6.some jumper cables

Step 2: Attach the Arduino and the Mic Into the Box As Shown

Step 3: Now Attach the Led to the Cap With Tape or Glue

Step 4: Wiring

1.connect the +ve end of the led to the digital-pin 8.

2.connect the -ve end of the led to the gnd.

3.connect the vcc of the MIC to 3.3v.

4.connect the gnd of the MIC to the gnd.

5.connect the OUT of the MIC to the digital-pin 10.

Step 5: CODING

copy,paste on the ide..........

int alkis = 0;
long algilama_araligi_baslangic = 0;

long algilama_araligi = 0;

boolean isik_durumu = false;

void setup(){

pinMode(10, INPUT);

pinMode(8, OUTPUT); }

void loop()

{ if(digitalRead(10) == 0){

if(alkis == 0){

algilama_araligi_baslangic = algilama_araligi = millis();

alkis++;

}

else if(alkis > 0 && millis() - algilama_araligi >= 49){

algilama_araligi = millis();

alkis++;

}

}

if(millis() - algilama_araligi_baslangic >= 399){

if(alkis == 2){

if(!isik_durumu){

isik_durumu = true;

digitalWrite(8, HIGH);

}

else if(isik_durumu){

isik_durumu = false;

digitalWrite(8, LOW);

}

} alkis = 0;

}

}

Step 6: You Are Done.

Share

    Recommendations

    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Trash to Treasure

      Trash to Treasure
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments

    Very nice,neat andd perfect.You are the best