Quantcast
Channel: Arduino Forum - Latest topics
Viewing all articles
Browse latest Browse all 15374

Led light Clap Switch Issue

$
0
0

I am currently working on my first ever arduino project, a clap switch for a led light but it doesn’t seem to be working :smiling_face_with_tear:, please I need help

I will type out my code below

#include <Arduino.h>

const int=11;
const int= A2;
const int threshold= 200;

Void setup () {
Serial.begin (9600);
pinMode(ledpin, OUTPUT);
PinMode(soundpin, INPUT);

}

Void loop () {
int soundValue = analogRead(soundpin);
Serial.println(soundValue);

If ( soundValue >= threshold) {
digitalWrite( ledpin, HIGH);
Serial.print(“sound Value: “);
Serial.print (“Sound Detected”);

}else {
digitalWrite(ledpin, LOW);
Serial.println ( “LED OFF”);
}

delay(500);
}

3 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 15374

Trending Articles