Skip to content

Commit

Permalink
fix melody player initialization in examples for esp32
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianoriccardi committed May 15, 2022
1 parent c7b86bf commit 972cb6f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ int buzzerPin1 = 4;
int buzzerPin2 = 5;

MelodyPlayer player1(buzzerPin1);

#ifdef ESP32
MelodyPlayer player2(buzzerPin2, 2);
#else
MelodyPlayer player2(buzzerPin2);
#endif

unsigned long start = 0;
bool transfered = false;
Expand Down Expand Up @@ -57,7 +62,7 @@ void setup() {
void loop() {
if (millis() - start > 2000 && !transfered) {
transfered = true;
Serial.println("Continuing the melody playback on a different buzzer...");
Serial.println("Continuing the melody playback on the second buzzer...");
player1.transferMelodyTo(player2);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ int buzzerPin1 = 4;
int buzzerPin2 = 5;

MelodyPlayer player1(buzzerPin1);

#ifdef ESP32
MelodyPlayer player2(buzzerPin2, 2);
#else
MelodyPlayer player2(buzzerPin2);
#endif

unsigned long start = 0;
bool transfered = false;
Expand Down

0 comments on commit 972cb6f

Please sign in to comment.