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();
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
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, MKR1000, MKR1010, MKR Zero, Nano33IoT, Nano33BLE and ESP32 boards.
Introduced in R2014b