Code And Circuit Diagram For Controlling Room Lights With A Clap





int micPin = A0;
int gndPin = A1;
int powerPin = A2;
int micValue1 = 0;
int micValue2 = 0;
int led1 = 13;
boolean lightOn = false;

 

void setup() {
pinMode(led1, OUTPUT);
pinMode(powerPin, OUTPUT);
pinMode(gndPin, OUTPUT);
pinMode(micPin, INPUT);
digitalWrite(gndPin,LOW);
delay(500);
digitalWrite(powerPin,HIGH);
Serial.begin(9600);
}

void loop() {
micValue1 = analogRead(micPin);
Serial.println(micValue1);
delay(1);
micValue2 = analogRead(micPin);
Serial.println(micValue2);

if (micValue1-micValue2 > 2||micValue2-micValue1 > 2){
lightOn = !lightOn;
delay(100);
digitalWrite(led1, lightOn);
}
}

 

IF YOU ARE GETTING A STRAY ERROR CLICK HERE



10 thoughts on “Code And Circuit Diagram For Controlling Room Lights With A Clap

  • March 15, 2018 at 9:08 am
    Permalink

    can u please help me for more detail about this project

    Reply
  • March 16, 2018 at 9:49 pm
    Permalink

    Gratifying website with cluster of ads… Authentic ad_earning. Suprisingly not suprised.

    Reply
    • March 21, 2018 at 3:53 am
      Permalink

      I’ll remove them sir sorry

      Reply
  • March 23, 2018 at 4:39 pm
    Permalink

    where is the circuit diagram ???

    Reply
    • March 26, 2018 at 2:04 am
      Permalink

      Soo sorry for that brother … I’ll do it today positively

      Reply
  • March 24, 2018 at 11:35 am
    Permalink

    Hi there,
    bro where is the circuit diagram? There is no link for the circuit diagram and what about the android app you used? How to get that app?

    Reply
    • March 26, 2018 at 2:04 am
      Permalink

      I didn’t use any app for this . And for circuit I’ll upload a diagram soon..

      Reply
      • July 24, 2019 at 9:04 pm
        Permalink

        Bro I need circuit diagram please upload it soon

        Reply

Leave a Reply to admin Cancel reply

Your email address will not be published. Required fields are marked *