Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int sensorPin = 0; //Microphone Sensor Pin on analog 0
- int ledPin = 13;
- int sensorValue = A0;
- void setup() {
- pinMode(ledPin, OUTPUT);
- Serial.begin(9600);
- }
- void loop() {
- // read the value from the sensor:
- sensorValue = analogRead(sensorPin);
- Serial.println(sensorValue);
- delay(0);
- if (sensorValue > 670) {
- // turn LED on:
- digitalWrite(ledPin, HIGH);
- delay(50);
- digitalWrite(ledPin, LOW);
- }
- else {
- // turn LED off:
- digitalWrite(ledPin, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement