Created
December 15, 2019 15:17
-
-
Save samilkorkmaz/ff14c1cbd9c3d0ce09cf17acc9dd67db to your computer and use it in GitHub Desktop.
rodeoBuzzerDoReMiiMii
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Reference: https://www.arduino.cc/en/Tutorial/ToneMelody?from=Tutorial.Tone | |
#define NOTE_C4 262 | |
#define NOTE_D4 294 | |
#define NOTE_E4 330 | |
#define NOTE_F4 349 | |
#define NOTE_G4 392 | |
#define NOTE_A4 440 | |
#define buzzerPin 3 | |
void setup() { | |
pinMode(buzzerPin, OUTPUT); | |
} | |
void play(unsigned int freq_Hz, unsigned long duration_ms) { | |
tone(buzzerPin, freq_Hz, duration_ms); | |
delay(duration_ms*1.10); | |
//noTone(buzzerPin); | |
} | |
void loop() { | |
play(NOTE_C4, 500); | |
play(NOTE_D4, 500); | |
play(NOTE_E4, 1000); | |
play(NOTE_E4, 1000); | |
play(NOTE_E4, 500); | |
play(NOTE_F4, 500); | |
play(NOTE_E4, 1000); | |
play(NOTE_D4, 1000); | |
play(NOTE_D4, 500); | |
play(NOTE_E4, 500); | |
play(NOTE_F4, 2000); | |
play(NOTE_A4, 500); | |
play(NOTE_G4, 500); | |
play(NOTE_F4, 500); | |
play(NOTE_E4, 1000); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment