Play tone on piezo speaker using digital pin
Play a Tone on a Piezo Speaker
Play a tone connected to digital pin 5 on the Arduino hardware for 10 seconds at 2400Hz.
a = arduino(); playTone(a,'D5',2400,10);
a — Arduino hardware connection
Arduino hardware connection
arduino, specified as an object.
pin — Digital pin number
Digital pin number on the physical hardware, specified as a character vector.
frequency — Frequency of tone
Frequency of tone to be played, specified as a number between
the frequency range
duration — Duration of tone
Duration of tone to be played specified as a number, which represents the number of seconds.
Valid values are between
This function is not supported on the Arduino Due boards.