Tweet

Replying to @josecastillo

The new and improved setup: we have a list of periods for the notes we want to play. We can use those to set the TCC’s PER value, which sets the frequency of the wave. Then when the buzzer wants to buzz, it sets its compare value to half of the period, giving it a 50% duty cycle.

(original)