Harsh Sharma Technicals

Everything About Technology At One Place

Codes And Circuit Diagrams

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

  • can u please help me for more detail about this project

    Reply
  • Kaaju Kaizu

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

    Reply
    • I’ll remove them sir sorry

      Reply
  • where is the circuit diagram ???

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

      Reply
  • Ehtisham Safdar

    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
    • I didn’t use any app for this . And for circuit I’ll upload a diagram soon..

      Reply
      • Bro I need circuit diagram please upload it soon

        Reply

Leave a Reply

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