Adding example of how to use a buzzer (#570)

* Adding example of how to use a buzzer

* Making sub-sections
This commit is contained in:
declanshanaghy 2020-05-10 12:29:49 -07:00 committed by GitHub
parent 9b6170ac60
commit af01734499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 0 deletions

View File

@ -12,6 +12,9 @@ of the ESP32 as an output component.
The frequency range of LEDC is from 10Hz to 40MHz - however, higher frequencies require a smaller
bit depth which means the output is not that accurate for frequencies above ~300kHz.
Example Usage For a Light
*************************
.. code-block:: yaml
# Example configuration entry
@ -26,6 +29,40 @@ bit depth which means the output is not that accurate for frequencies above ~300
output: gpio_19
name: "Kitchen Light"
Example Usage For a Piezo Buzzer
********************************
.. code-block:: yaml
# Configure the output
output:
- platform: ledc
######################################################
# One buzzer leg connected to GPIO12, the other to GND
######################################################
pin: GPIO12
id: buzzer
# Example usage in an automation
on_press:
then:
######################################################
# Must be turned on before setting frequency & level
######################################################
- output.turn_on: buzzer
######################################################
# Frequency sets the wave size
######################################################
- output.ledc.set_frequency:
id: buzzer
frequency: "1000Hz"
######################################################
# level sets the %age time the PWM is on
######################################################
- output.set_level:
id: buzzer
level: "50%"
Configuration variables:
------------------------