tone() and noTone()

Produces a tone with the specified frequency on a pin. noTone() turns off the tone leaving the pin in output low state. Those functions are usefull to produce audio feedback to the user. tone() is not blocking - the tone is produced by the timer as a background process. Functions tone()/noTone() requires Tone.h include file. tone() works only with fast pins defined via s_pin data type and hence can work only on pins 9–16. tone() uses GPT, so GPT can not be used simultaneously with tone(). Occupies TIMER0 peripheral. Supports all available pins, but only up to 4 channels simultaneously. tone(pin, frequency); pin the number of the pin on which you want to produce a tone (s_pin type) the number of the pin on which you want to produce a tone frequency frequency of the tone in Hertz none noTone(pin); pin the number of the pin on which you want to produce a tone (s_pin type) the number of the pin on which you want to produce a tone none

// Plays A note on pin #11 for 1 second every 5 seconds
#include "Tone.h"

void setup() {
}

void loop() {
  tone(11, 440);
  delay(1000);
  noTone(11);
  delay(4000);
}