Created
September 6, 2015 10:11
-
-
Save ringodin/f1a520c6edabf1ce8d83 to your computer and use it in GitHub Desktop.
This is for a tiny piezo speaker connected to your arduino
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
/* | |
Multiple tones from a piezo speaker | |
circuit: | |
put a small piezo speaker on digital pin 8 | |
and then ground it | |
(need not be a PWM pine) | |
no resistor needed | |
modified by Ringotron5000 | |
*/ | |
void setup() { | |
} | |
void loop() { | |
tone(8, 440, 200); //play tone on pin 8 of 440 Hz for 200 ms | |
delay(200); | |
tone(8, 240, 200); //play tone on pin 8 of 240 Hz for 200 ms | |
delay(200); | |
tone(8, 120, 200); | |
delay(200); | |
tone(8, 880, 200); | |
delay(200); | |
noTone(8); // turn off tone function for pin 8: | |
delay(3000); // give your ears a break for 3 seconds | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment