playTone
R2026bPlay tone on piezo speaker using digital pin
Description
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Examples
Input Arguments
Limitations
This function is not supported on the Arduino Due and ESP32 boards.
Alternative Functionality
App
Use the Pin Explorer pane in Arduino Explorer to play a tone on a piezo speaker, for a particular frequency or duration. You can use the app in the installed version of MATLAB® and MATLAB Online™. The speaker can be attached to a digital pin on Arduino or other supported hardware. In the Pin Configuration panel, set the Mode as Tone, Tone Mode as Frequency or Duration, and if required specify a Label to uniquely identify the pin. For more information, see Configure Read and Write for GPIO Pins Using Arduino Explorer App.
Version History
Introduced in R2014b