2010-03-08 16:51:02 +01:00
|
|
|
/*
|
|
|
|
Multiple tone player
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2010-03-08 16:51:02 +01:00
|
|
|
Plays multiple tones on multiple pins in sequence
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2010-03-08 16:51:02 +01:00
|
|
|
circuit:
|
2017-07-12 21:30:49 +02:00
|
|
|
- 3 8-ohm speaker on digital pins 6, 7, and 8
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2010-03-08 16:51:02 +01:00
|
|
|
created 8 March 2010
|
2013-10-21 09:58:40 +02:00
|
|
|
by Tom Igoe
|
2010-03-08 16:51:02 +01:00
|
|
|
based on a snippet from Greg Borenstein
|
|
|
|
|
|
|
|
This example code is in the public domain.
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2015-05-20 17:10:06 +02:00
|
|
|
http://www.arduino.cc/en/Tutorial/Tone4
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2010-03-08 16:51:02 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2013-05-23 16:24:38 +02:00
|
|
|
// turn off tone function for pin 8:
|
2013-10-21 09:58:40 +02:00
|
|
|
noTone(8);
|
2010-03-08 17:42:48 +01:00
|
|
|
// play a note on pin 6 for 200 ms:
|
2010-03-08 16:51:02 +01:00
|
|
|
tone(6, 440, 200);
|
|
|
|
delay(200);
|
|
|
|
|
2010-03-08 17:42:48 +01:00
|
|
|
// turn off tone function for pin 6:
|
2010-03-08 16:51:02 +01:00
|
|
|
noTone(6);
|
2010-03-08 17:42:48 +01:00
|
|
|
// play a note on pin 7 for 500 ms:
|
2010-03-08 16:51:02 +01:00
|
|
|
tone(7, 494, 500);
|
|
|
|
delay(500);
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2010-03-08 17:42:48 +01:00
|
|
|
// turn off tone function for pin 7:
|
2013-10-21 09:58:40 +02:00
|
|
|
noTone(7);
|
2013-05-23 16:24:38 +02:00
|
|
|
// play a note on pin 8 for 500 ms:
|
|
|
|
tone(8, 523, 300);
|
2010-03-08 16:51:02 +01:00
|
|
|
delay(300);
|
|
|
|
}
|