Tutorial.Tone4 History

Hide minor edits - Show changes to output

May 02, 2012, at 03:38 AM by Scott Fitzgerald -
Changed lines 40-41 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/2.Digital/toneMultiple/toneMultiple.ino lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/02.Digital/toneMultiple/toneMultiple.ino lang=arduino tabwidth=4:)
November 16, 2011, at 04:09 AM by Scott Fitzgerald -
Changed lines 40-41 from:
(:source http://arduino.cc/en/pub/code/new-extension/build/shared/examples/2.Digital/toneMultiple/toneMultiple.ino lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/2.Digital/toneMultiple/toneMultiple.ino lang=arduino tabwidth=4:)
September 30, 2011, at 03:05 AM by Scott Fitzgerald -
Changed lines 40-41 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/2.Digital/toneMultiple/toneMultiple.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/new-extension/build/shared/examples/2.Digital/toneMultiple/toneMultiple.ino lang=arduino tabwidth=4:)
September 23, 2010, at 10:31 PM by Christian Cerrito -
Changed lines 3-4 from:
!!SPlaying tones on Multiple outputs using the tone() function
to:
!!!SPlaying tones on Multiple outputs using the tone() function
August 25, 2010, at 06:56 AM by Christian Cerrito -
Added lines 11-18:
!!!Hardware Required

* (3) 8-ohm speakers
* (3) 100 ohm resistor
* breadboard
* hook up wire

Changed lines 42-49 from:
(:divend:)
to:
(:divend:)

!!!See Also:
* [[(Reference/)tone]]()

* [[Tone | Tone]] - play a melody with a piezo speaker
* [[Tone2 | Pitch follower]] - play a pitch on a piezo speaker depending on an anlog input.
* [[Tone 3]] - a three-key musical keyboard using force sensors
August 24, 2010, at 08:11 AM by Christian Cerrito -
Changed lines 32-33 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/Digital/toneMultiple/toneMultiple.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/2.Digital/toneMultiple/toneMultiple.pde lang=arduino tabwidth=4:)
March 08, 2010, at 04:51 PM by Tom Igoe -
Added lines 8-10:

Thanks to Greg Borenstein for clarifying this.
Changed lines 32-33 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/Digital/toneKeyboard/toneMultiple.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/Digital/toneMultiple/toneMultiple.pde lang=arduino tabwidth=4:)
March 08, 2010, at 04:50 PM by Tom Igoe -
Added lines 1-31:
''Examples > Digital I/O''

!!SPlaying tones on Multiple outputs using the tone() function

This example shows how to use the tone() command to play different notes on multiple outputs.

The tone() command works by taking over one of the Atmega's internal timers, setting it to the frequency you want, and using the timer to pulse an output pin. Since it's only using one timer, you can only play one note at a time. You can, however, play notes on multiple pins sequentially. To do this, you need to turn the timer off for one pin before moving on to the next.
!!!Circuit

%height=300px%[[Attach:arduino_3_speakers_bb.png | Attach:arduino_3_speakers_bb.png]]

[-image developed using [[http://www.fritzing.org |Fritzing]]. For more circuit examples, see the [[http://fritzing.org/projects/|Fritzing project page]] -]


!!!Schematic

[-click the image to enlarge-]

%height=300px%[[Attach:arduino_3_speakers_schem.png | Attach:arduino_3_speakers_schem.png]]


!!! Code
The sketch below plays a tone on each of the speakers in sequence, turning off the previous speaker first. Note that the duration of each tone is the same as the delay that follows it.

Here's the main sketch:

(:div class=code :)

(:source http://arduino.cc/en/pub/code/master/build/shared/examples/Digital/toneKeyboard/toneMultiple.pde lang=arduino tabwidth=4:)

(:divend:)

Share