Skip to content

Commit

Permalink
docs: Add microphone.sound_level_db() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-carlos committed Mar 21, 2024
1 parent acee09a commit e0f97f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/microbit_micropython_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ The Microphone is accessed via the `microphone` object::
set_threshold(128)
# Returns a representation of the sound pressure level in the range 0 to 255.
sound_level()
# Returns a representation of the sound pressure level in decibels (dB).
sound_level_db()

Pins
----
Expand Down
5 changes: 4 additions & 1 deletion docs/microphone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Functions
* **event**: a sound event, such as ``SoundEvent.LOUD`` or
``SoundEvent.QUIET``.

* **value**: The threshold level in the range 0-255. For example,
``set_threshold(SoundEvent.LOUD, 250)`` will only trigger if the sound is
very loud (>= 250).
Expand All @@ -70,6 +70,9 @@ Functions
* **return**: a representation of the sound pressure level in the range 0 to
255.

.. py:function:: sound_level_db()
* **return**: a representation of the sound pressure level in decibels (dB).

Example
=======
Expand Down

0 comments on commit e0f97f6

Please sign in to comment.