Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.
| Name | tone() |
||||||
|---|---|---|---|---|---|---|---|
| Examples | void setup() { // generates a 400Hz tone in output pin 8 with 2000ms of duration tone(8, 400, 2000); } void loop() { } void setup() { // generates a 415Hz tone in output pin 8 with infinite duration tone(8, NOTE_GS4); } void loop() { } |
||||||
| Description | The tone() generates a tone of a determined frequency in hertz on a specific pin for a specified duration. The tone command uses timer resources to generate the tone accurately. Use a negative number in duration for infinite duration. If a previous tone command is playing, and a new pin is specified, and tonePolyphony has been set to > 1, and there are available timers, a simultaneous tone will be played on the new pin. | ||||||
| Syntax | tone(pin, frequency, duration) tone(pin, frequency) |
||||||
| Parameters |
|
||||||
| Returns | None | ||||||
| Usage | Application | ||||||
| Related | tone() noTone() setTonePolyphony() getTonePolyphony() |

