Created
September 25, 2016 09:09
-
-
Save ringodin/718b5758f2caf8fcc8162d2e0705a724 to your computer and use it in GitHub Desktop.
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 | |
*/ | |
int speakerPin = 8; | |
void setup() { | |
} | |
void loop() { | |
tone(speakerPin, 440, 200); //play tone on pin 8 of 440 Hz for 200 ms | |
delay(200); | |
tone(speakerPin, 240, 200); //play tone on pin 8 of 240 Hz for 200 ms | |
delay(200); | |
tone(speakerPin, 120, 200); | |
delay(200); | |
tone(speakerPin, 880, 200); | |
delay(200); | |
noTone(speakerPin); // 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