Arduino Programming Language: NoTone

Name

noTone()

Description

The noTone() function stops the generation of a frequency in a specified pin.

Syntax

noTone(PIN);

Parameters

int: the output pin number to stop generating tone

  • pin

Returns

none 

Usage

Application

Examples

void setup() {
// put a switch on pin 12 and set it as input
pinMode(12, INPUT);
// generates a tone of 432Hz on output pin 8
// time is not set so the frequency is infinite
tone(8, 432);
}

void loop() {
// if the switch is pressed stop the tone on pin 8
if (digitalRead(12) == HIGH) {
noTone(8);
}
}

Related Functions


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc