Introduction: Lights On/off on Clap With LinkitONE
Hi friends,
i'll show you how to turn lights on and off on clap!
We will use sound sensor to detect clap and then turn on LED.
Step 1: Parts
You will need-
1 x LinkitONE
1 x Sound sensor
1 x LED
Step 2: Connect Sound Module
Connect sound module to LinkitONE. Connect it to the A0 pin of arduino.
Give ground and power to the other 2 pins that are left.
Step 3: Connect LED
Connect the LED on pin number 11 of your LinkitONE.
Step 4: Attach USB
Connect your USB cable now so we can power up the system.
Step 5: Code
Burn this code to your board.
void setup()
{
pinMode(A0, INPUT);
pinMode(11,OUTPUT);
Serial.begin(9600);
}
void loop()
{
int a;
a=analogRead(A0);
Serial.print(a);
Serial.print("\n");
if(a<1000)
{
digitalWrite(11,HIGH);
}
else
{
digitalWrite(11,LOW);
delay(1000);
}
Step 6: Give a Clap and Test!
Give a clap now. You will see the LED light up!