Untitled
unknown
csharp
3 years ago
383 B
1
Indexable
Never
const int ledpin = 13; const int soundpin = A2; const int threshold = 200; void setup() { Serial.begin(9600); pinMode(ledpin, OUTPUT); pinMode(soundpin, OUTPUT); } void loop() { int soundsens = analogRead(soundpin); if (soundsens >= threshold) { digitalWrite(ledpin, HIGH); delay(1000); } else { digitalWrite(ledPin, LOW) } }