Last active
December 17, 2019 18:44
-
-
Save samilkorkmaz/e365cf060832ad7fe81a5835b208166a to your computer and use it in GitHub Desktop.
rodeoSiren
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_F4 349 | |
#define buzzerPin 3 | |
void setup() { | |
pinMode(buzzerPin, OUTPUT); | |
pinMode(LED_BUILTIN, OUTPUT); | |
} | |
void play(unsigned int freq_Hz, unsigned long duration_ms) { | |
tone(buzzerPin, freq_Hz, duration_ms); | |
delay(duration_ms*1.10); | |
} | |
void loop() { | |
digitalWrite(LED_BUILTIN, HIGH); | |
play(NOTE_F4, 500); | |
digitalWrite(LED_BUILTIN, LOW); | |
play(NOTE_C4, 500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment