Hello, I am currently working on a school project. Everything is going smoothly up until to the arduino part. The arduino handles the speaker using the PCM library. What happens is, ESP32 sends a string "alarm" to play the audio once the arduino receives this string through serial connection. I have read the library of the PCM and have found that it uses pin 11 as the default pin. My question is, is it possible for me to play audio in three or four different speakers? For example
speaker1 - 11
speaker2 - 10
speaker3 - 9
if it is, how can i do it?
#include <PCM.h>
const int speakerPin2 = 3;
const int speakerPin3 = 10;
const int speakerPin4 = 9;
const unsigned char sample[] PROGMEM = { (audio bits, have not included since it is too long)
void setup() {
Serial.begin(9600);
while(!Serial);
}
void loop() {
if (Serial.available()){
String ESP = Serial.readString();
if (ESP == "ALARM"){
startPlayback(sample, sizeof(sample));
Serial.println(ESP);
} else {
Serial.println("Good");
}
}
}