I have tried all sorts of things from copying the buzzer ledc code and numerous code samples from various users from this forum. Every time I try to validate the code it fails to validate.
I tried copying the example code from here: ESP32 LEDC Output — ESPHome and my .yaml file will not validate with that code?
Can someone please help me configure a buzzer on my esp32dev board? I am just testing it out to see if i can do this and get it to work.
Here is my .yaml code that is working and I can see it in ESPHome.
INFO ESPHome 2024.12.4
INFO Reading configuration /config/esphome/west-alarm2.yaml...
ERROR Error while reading config: Invalid YAML syntax:
while parsing a block collection
in "/config/esphome/west-alarm2.yaml", line 88, column 3
expected <block end>, but found '?'
in "/config/esphome/west-alarm2.yaml", line 92, column 3
What I was trying to accomplish was having a button in HA so when I press it, it will beep for now. Later I was hoping to expand it to a beep, beep for a door. I also want a constant beep for my garage door, for lets say 10 seconds before it automatically closes.
But, at this point I would like to see a switch or button in HA to where I can make a single beep.
So, I have tried a few things to get this to go. I have tried adding a switch (component) and I failed at adding that as well? I am not too sure where that code went but tried adding it as a switch.
What I am working with is a 3.3v buzzer, on pin 5. My board supports 3.3v and 5v.
You asked why ledc, I am not too sure why because I am just getting into ESPHome and want to learn it. I am a beginner at this so, if there are better ways to do what I have researched, I am up for what ever someone suggests to me.
I also have an issue with my Relay as well but was going to tackle that in another thread.
Yes, they both work correctly now. I can hear a long beep until I turn it off. And the Relay is now working as well. I can hear the relay click on and off.
I appreciate the help.
One other thing, two or three.
What if I want a beep, beep on the buzzer and have it switch off?
Second, the beep/buzzer the sound is low, how can I make it louder?
Third, for the relay, what if I want it to preform a momentary on (kind of like pushing a button.
If you do not have the time to explain these I can put it in as a question to the ESPHome forum.
Thank you very much for all the help and advice. You rock! Cheers!
Thank you for the diagram. Do you have a link for an Amazon product that I can build/test with? I think in your diagram it’s a transistor and not a mosfet, right?