Hello,
I am trying to connect my computer's native (or default) microphone to my Arduino Uno. Basically, my final project is to create a physical mute button (using the microprocessor) and make the green LED turn on when unmuted, and the red LED turn on when muted. So far, I got the LED and button coding down, but I have to find out a way to connect that to the default microphone in a computer, so a press of a button will completely mute the microphone in the system. Please let me know if there is some sort of connectivity with the computer microphone that I can use for this project.
int pushButton = 2;
const int GREENLED = 3;
const int REDLED = 4;
int ledflag=0; // LED status flag
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// make the pushbutton's pin an input:
pinMode(pushButton, INPUT);
pinMode(GREENLED, OUTPUT);
pinMode(REDLED, OUTPUT);
digitalWrite(GREENLED,LOW); // turn output off just in case
digitalWrite(REDLED,LOW);
}
// the loop routine runs over and over again forever:
void loop() {
int buttonState = digitalRead(pushButton);
if (buttonState == 1)
{
Serial.println("1");
}
else{
Serial.println("0");
}
delay(100);
if (digitalRead(pushButton)==HIGH){
if (ledflag==0) {
ledflag=1;
digitalWrite(GREENLED,HIGH);
}
else {
ledflag=0;
digitalWrite(GREENLED,LOW);
}
delay(100);
}
if (digitalRead(GREENLED)==HIGH){
digitalWrite(REDLED,LOW);
}
else {
digitalWrite(REDLED,HIGH);
}
}