The funniest part, howewer, is how I made it
#play #music. I know I can toggle a pin to produce a square wave with a certain frequency, but I don't know anything about music and correspondence between notes and frequencies, and I surely didn't want to reinvent the wheel.
The recommended way to play music with a
#microcontroller is to use a
#DAC meant for that, or some sort of polyphonic chip, but I needed a simpler and hackier way.
And i found it in the awesome
#esphome documentation:
https://esphome.io/components/rtttl.htmlESPHome supports
#RTTTL. What's RTTTL? Do you remember painstakingly typing letters on your
#Nokia gummy keyboard, copying it from some
#90s magazine, to have the last and greatest
#ringtones? Yes, that format was called RTTTL, and is supported by ESPHome! What a trip in the past!
I'm deadly serious, just look at the relevant wikipedia page!
https://en.wikipedia.org/wiki/Ring_Tone_Text_Transfer_Languageπ§΅