Arduino Clap LED program #define MicAO 8 int ledPin = 13; int clap = 0; long detection_range_start = 0; long detection_range = 0; boolean status_lights = false; void setup() { pinMode(MicAO, INPUT); pinMode(ledPin,OUTPUT); } void loop() { int status_MicAO = digitalRead(MicAO); if (status_MicAO == 0) { if (clap == 0) { detection_range_start = detection_range = millis(); clap++; } else if (clap > 0 && millis()-detection_range >= 50) { detection_range = millis(); clap++; } } if (millis()-detection_range_start >= 400) { if (clap == 2) { if (!status_lights) { status_lights = true; digitalWrite(ledPin, HIGH); } else if (status_lights) { status_lights = false; digitalWrite(ledPin, LOW); } } clap = 0; } }
It's really a nice and helpful piece of information about this heating and air conditioning repair topic. I'm glad that you shared this helpful info with us. Please keep us informed like this.
ReplyDeleteI am glad to find amazing information from the blog. Thanks for sharing the information. for more useful Information visit:
ReplyDeletewindow ac price in uae 2019