#include "tones.h"
#define SPEAKER_PIN 4 // Define the pin your speaker is connected to, modify as per your setup
void setup() {
pinMode(SPEAKER_PIN, OUTPUT); // Set speaker pin to output mode
}
void p(unsigned int freq, unsigned int delay_ms,boolean skipDelay = false) {
tone(SPEAKER_PIN, freq); // play tone on SPEAKER_PIN at freq (in Hz)
if (!skipDelay) {
delay(delay_ms); // sound duration
noTone(SPEAKER_PIN); // stop sound
}
}
void loop() {
p(NOTE_F3, 200);
delay(200);
p(NOTE_A3, 200, true);
p(NOTE_C4, 200);
delay(200);
p(NOTE_A3, 200, true);
p(NOTE_C4, 200);
delay(200);
}