void tone(uint8_t pin, unsigned int frequency, unsigned long duration)
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.
tone() conforms to the Arduino 1.6.x API.
Play a 1 second 2KHz tone:
tone(3, 2000, 1000);