| 1 |
/* |
| 2 |
Multiple tone player |
| 3 |
|
| 4 |
Plays multiple tones on multiple pins in sequence |
| 5 |
|
| 6 |
circuit: |
| 7 |
- three 8 ohm speakers on digital pins 6, 7, and 8 |
| 8 |
|
| 9 |
created 8 Mar 2010 |
| 10 |
by Tom Igoe |
| 11 |
based on a snippet from Greg Borenstein |
| 12 |
|
| 13 |
This example code is in the public domain. |
| 14 |
|
| 15 |
https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMultiple |
| 16 |
*/ |
| 17 |
|
| 18 |
void setup() { |
| 19 |
|
| 20 |
} |
| 21 |
|
| 22 |
void loop() { |
| 23 |
// turn off tone function for pin 8: |
| 24 |
noTone(8); |
| 25 |
// play a note on pin 6 for 200 ms: |
| 26 |
tone(6, 440, 200); |
| 27 |
delay(200); |
| 28 |
|
| 29 |
// turn off tone function for pin 6: |
| 30 |
noTone(6); |
| 31 |
// play a note on pin 7 for 500 ms: |
| 32 |
tone(7, 494, 500); |
| 33 |
delay(500); |
| 34 |
|
| 35 |
// turn off tone function for pin 7: |
| 36 |
noTone(7); |
| 37 |
// play a note on pin 8 for 300 ms: |
| 38 |
tone(8, 523, 300); |
| 39 |
delay(300); |
| 40 |
} |