Tone

From chipKIT
Jump to: navigation, search

Synopsis

void tone(uint8_t pin, unsigned int frequency, unsigned long duration)

Description

Generate a tone (square wave) on an I/O pin at frequency Hz. If duration is greater than 0 the tone will play for the specified number of milliseconds. If duration is less than 0 it will be generated indefinitely until noTone() is called. If duration is 0 it acts the same as if noTone() had been called.

Return Value

None

Conforming To

tone() conforms to the Arduino 1.6.x API.

Examples

Play a 1 second 2KHz tone:

tone(3, 2000, 1000);

See Also

noTone()