I have figured out how to make a piezo buzzer play two tones at once with analogWrite() and tone() but how would I make an actual song by playing both bass and treble, such as this one. Here is the circuit I had to do it:
and here is the code I had to do it:
int buzzer1 = 9;
int buzzer2 = 10;
void setup() {
pinMode(buzzer1, OUTPUT);
pinMode(buzzer2, OUTPUT);
}
void loop() {
analogWrite(buzzer1, 100);
tone(buzzer2, 262);
}
