From 5d5f1aff09587c3b9fc78dd7de603e8e2e2c0cc8 Mon Sep 17 00:00:00 2001
From: krekr <gregor@krekr.nl>
Date: Thu, 22 Jun 2023 10:44:32 +0200
Subject: [PATCH 1/4] Update toneMelody.ino

---
 examples/02.Digital/toneMelody/toneMelody.ino | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/examples/02.Digital/toneMelody/toneMelody.ino b/examples/02.Digital/toneMelody/toneMelody.ino
index 22022dc..7afcb69 100644
--- a/examples/02.Digital/toneMelody/toneMelody.ino
+++ b/examples/02.Digital/toneMelody/toneMelody.ino
@@ -17,6 +17,8 @@
 
 #include "pitches.h"
 
+int buzzerPin = 8;
+
 // notes in the melody:
 int melody[] = {
   NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4
@@ -34,14 +36,14 @@ void setup() {
     // to calculate the note duration, take one second divided by the note type.
     //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
     int noteDuration = 1000 / noteDurations[thisNote];
-    tone(8, melody[thisNote], noteDuration);
+    tone(buzzerPin, melody[thisNote], noteDuration);
 
     // to distinguish the notes, set a minimum time between them.
     // the note's duration + 30% seems to work well:
     int pauseBetweenNotes = noteDuration * 1.30;
     delay(pauseBetweenNotes);
     // stop the tone playing:
-    noTone(8);
+    noTone(buzzerPin);
   }
 }
 

From 569885ba613109337ed2952f4387714a04516fdf Mon Sep 17 00:00:00 2001
From: krekr <gregor@krekr.nl>
Date: Thu, 22 Jun 2023 10:45:45 +0200
Subject: [PATCH 2/4] Update toneKeyboard.ino

---
 examples/02.Digital/toneKeyboard/toneKeyboard.ino | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/02.Digital/toneKeyboard/toneKeyboard.ino b/examples/02.Digital/toneKeyboard/toneKeyboard.ino
index c8e73c6..64c1438 100644
--- a/examples/02.Digital/toneKeyboard/toneKeyboard.ino
+++ b/examples/02.Digital/toneKeyboard/toneKeyboard.ino
@@ -19,6 +19,8 @@
 
 #include "pitches.h"
 
+int buzzerPin = 8;
+
 const int threshold = 10;  // minimum reading of the sensors that generates a note
 
 // notes to play, corresponding to the 3 sensors:
@@ -37,7 +39,7 @@ void loop() {
     // if the sensor is pressed hard enough:
     if (sensorReading > threshold) {
       // play the note corresponding to this sensor:
-      tone(8, notes[thisSensor], 20);
+      tone(buzzerPin, notes[thisSensor], 20);
     }
   }
 }

From d751d0b962aaa678fd52d65bba57df44d15e0fa4 Mon Sep 17 00:00:00 2001
From: krekr <gregor@krekr.nl>
Date: Thu, 22 Jun 2023 10:46:49 +0200
Subject: [PATCH 3/4] Update tonePitchFollower.ino

---
 examples/02.Digital/tonePitchFollower/tonePitchFollower.ino | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/02.Digital/tonePitchFollower/tonePitchFollower.ino b/examples/02.Digital/tonePitchFollower/tonePitchFollower.ino
index 592f671..ca0422f 100644
--- a/examples/02.Digital/tonePitchFollower/tonePitchFollower.ino
+++ b/examples/02.Digital/tonePitchFollower/tonePitchFollower.ino
@@ -17,6 +17,8 @@
   https://www.arduino.cc/en/Tutorial/BuiltInExamples/tonePitchFollower
 */
 
+int buzzerPin = 9;
+
 void setup() {
   // initialize serial communications (for debugging only):
   Serial.begin(9600);
@@ -34,6 +36,6 @@ void loop() {
   int thisPitch = map(sensorReading, 400, 1000, 120, 1500);
 
   // play the pitch:
-  tone(9, thisPitch, 10);
+  tone(buzzerPin, thisPitch, 10);
   delay(1);  // delay in between reads for stability
 }

From af1d7e43acf7223a6c2d2b2f02cbb868eb8822a4 Mon Sep 17 00:00:00 2001
From: krekr <gregor@krekr.nl>
Date: Thu, 22 Jun 2023 10:48:20 +0200
Subject: [PATCH 4/4] Update toneMultiple.ino

---
 .../02.Digital/toneMultiple/toneMultiple.ino     | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/examples/02.Digital/toneMultiple/toneMultiple.ino b/examples/02.Digital/toneMultiple/toneMultiple.ino
index 8d97fa7..ec3003b 100644
--- a/examples/02.Digital/toneMultiple/toneMultiple.ino
+++ b/examples/02.Digital/toneMultiple/toneMultiple.ino
@@ -15,25 +15,29 @@
   https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMultiple
 */
 
+int buzzerOnePin = 6;
+int buzzerTwoPin = 7;
+int buzzerThreePin = 8;
+
 void setup() {
 }
 
 void loop() {
   // turn off tone function for pin 8:
-  noTone(8);
+  noTone(buzzerThreePin);
   // play a note on pin 6 for 200 ms:
-  tone(6, 440, 200);
+  tone(buzzerOnePin, 440, 200);
   delay(200);
 
   // turn off tone function for pin 6:
-  noTone(6);
+  noTone(buzzerOnePin);
   // play a note on pin 7 for 500 ms:
-  tone(7, 494, 500);
+  tone(buzzerTwoPin, 494, 500);
   delay(500);
 
   // turn off tone function for pin 7:
-  noTone(7);
+  noTone(buzzerTwoPin);
   // play a note on pin 8 for 300 ms:
-  tone(8, 523, 300);
+  tone(buzzerThreePin, 523, 300);
   delay(300);
 }