Untitled
unknown
csharp
4 years ago
383 B
10
Indexable
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)
}
}Editor is loading...