Files
2018-08-06 12:05:38 +08:00

60 lines
941 B
ReStructuredText
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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