Hello everyone,
I have just uploaded Chapter 7 of my Raspberry Pi Pico Ada tutorial.
In this chapter we drive both active and passive buzzers. We start with a simple button-controlled doorbell, then move on to a sweeping alert tone. The original bit-banging version shows the limitations of software-generated frequencies, so I rewrote it using the RP2040 PWM peripheral together with Ada.Real_Time. The result is rock-solid timing with no audible jitter.
I also cover the hardware side: why you need a flyback diode with inductive loads and how a cheap oscilloscope helped me spot (and fix) 50 V spikes.
You will find the complete chapter here: Chapter 7: Buzzer ยท Pi Ada Tutorial
Alire crate: https://alire.ada.dev/crates/pico_ada_c07_buzzer/ (soon)
GNATdoc: https://pi-ada-tutorial.sourceforge.io/gnatdoc/pico_doc/
As always, the source code is on SourceForge: https://git.code.sf.net/p/pi-ada-tutorial/code
Feedback and questions are very welcome!
Best regards,