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 , 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