Thursday, 30 January 2020

Clap controlled Home appliances project data

Code:-


int Bulb = 9;       // signal to drive relay
int soundsensor = 7;   // input from sound sensor

boolean state = false;

void setup()
{
  pinMode(Bulb, OUTPUT);
  pinMode(soundsensor, INPUT);
}

void loop()
{
  if (digitalRead(soundsensor) == LOW)
  { 
    delay(100);                     
    state = !state;               
    digitalWrite(Bulb, state);   
  }
}

2 comments: