Created
February 26, 2025 02:59
-
-
Save futureshocked/ba4d9a93816728787c2cdfe54535d0ff to your computer and use it in GitHub Desktop.
Audio sensor tester for techexplorations.com/blog/course/advanced-pcb-design-kicad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MIC_PIN 5 // GPIO 5 is connected to the microphone | |
void setup() { | |
// Start serial communication for debugging | |
Serial.begin(115200); | |
while (!Serial); | |
// Configure GPIO 5 as input for the microphone signal | |
pinMode(MIC_PIN, INPUT); | |
} | |
void loop() { | |
// Read the value from the microphone (analog reading) | |
int micValue = analogRead(MIC_PIN); | |
// Print the microphone reading to the Serial Monitor | |
Serial.print("Microphone Value: "); | |
Serial.println(micValue); | |
// Wait a short time before reading again | |
delay(10); // Adjust the delay for the sampling rate (10ms) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment