//Author: Danny van den Brande, Arduinosensors.nl. BlueCore Tech. //This code is a simple example for the DIY clap switch that you need to solder yourself. // find it at this link http://www.aliexpress.com/item/Voice-control-switch-suite-DIY-kits-selling-electronic-circuit/32338281477.html?spm=2114.01010208.3.1.u7scnj&ws_ab_test=searchweb201556_7,searchweb201602_5_10037_10017_9878_10021_507_10022_10032_10009_10020_10008_10018_10019,searchweb201603_1&btsid=ef9560f7-7d93-4f72-ace9-a158709dabe3 const int Clap_Pin = 0; int Relay = 12; boolean sensorValue;// define numeric variables val void setup () { Serial.begin(9600); pinMode(Clap_Pin, INPUT); pinMode(Relay, OUTPUT); } void loop () { if (sensorValue == 1) { digitalWrite(Relay, LOW); } if (sensorValue == 0 ){ digitalWrite(Relay, HIGH); } sensorValue = digitalRead(Clap_Pin); Serial.println (sensorValue, DEC); delay(10); }