I am trying to make a project where i press a button and then the arduino recognizes the button press and sends an audio wave through an aux cord and into a phone or computer so that the computer can recognize the audio wave and I could then use it to do something. I want to be able to do this for two buttons. I know how to have the arduino tell the difference between the two buttons but i do not know how to output an audio wave. Any information on how to do this and what, if any, parts i will need.
here is my code for the 2 buttons
void setup() {
Serial.begin(9600);
//configure pin2 and pin3 as an input and enable the internal pull-up resistor
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(13, OUTPUT);
}
void loop() {
int sensorVal1 = digitalRead(2);
int sensorVal2 = digitalRead(3);
if (sensorVal1 == LOW) {
Serial.print("Btn1 down :"); Serial.print("Sensor1 value = ");
Serial.println(sensorVal1);
//code that will output the soundwave for button 1
}
if (sensorVal2 == LOW) {
Serial.print("Btn2 down :"); Serial.print("Sensor2 value = ");
Serial.println(sensorVal2);
//code that will output the soundwave for button 2
}
}