mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
updated "API Reference"
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
Speaker API
|
||||
************
|
||||
|
||||
-----------------------------
|
||||
|
||||
Function
|
||||
---------
|
||||
|
||||
volume(volume)
|
||||
>>>>>>>>>>>>>>>>
|
||||
|
||||
| **Description:**
|
||||
| Set the volume of sound
|
||||
|
||||
| **Parament:**
|
||||
| **volume:** sound volume
|
||||
|
||||
| **Example:**
|
||||
.. code:: python
|
||||
|
||||
from m5stack import *
|
||||
|
||||
speaker.volume(2)
|
||||
speaker.tone(freq=1800)
|
||||
|
||||
tone(freq [, duration])
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
||||
| **Description:**
|
||||
| Speak a sound with `frequency` and `duration`
|
||||
|
||||
| **Parament:**
|
||||
| **frequency:** the frequency of sound
|
||||
| **duration:** the duration of sound continued
|
||||
|
||||
|
||||
| **Return:**
|
||||
| None
|
||||
|
||||
| **Example:**
|
||||
.. code:: python
|
||||
|
||||
from m5stack import *
|
||||
|
||||
speaker.volume(2)
|
||||
speaker.tone(freq=1800)
|
||||
speaker.tone(freq=1800, duration=200) # Non-blocking
|
||||
|
||||
---------------------
|
||||
|
||||
Usage
|
||||
------
|
||||
|
||||
.. code:: python
|
||||
|
||||
from m5stack import *
|
||||
|
||||
speaker.volume(2)
|
||||
speaker.tone(freq=1800)
|
||||
speaker.tone(freq=1800, duration=200) # Non-blocking
|
||||
Reference in New Issue
Block a user