rsbohn · GitHub

I want to make a variety of beep noises with the ATtiny8x7 Seesaw Breakout. The PWMOut object suggests that changing the frequency is possible, but in practice it is not.

def sweep_down(high: int, low:int):
    spkr.frequency = high
    spkr.duty_cycle = 0x8000
    decay = 0.9
    while spkr.frequency > low:
        spkr.frequency = int(spkr.frequency * decay)
    spkr.duty_cycle = 0
sweep_down(2000,80)

This proposed code would make a sound that starts at 2000 Hz and drops to around 80 Hz, then silence.

Equipment:
I'm using
Adafruit CircuitPython 7.0.0 on 2021-09-20; Raspberry Pi Pico with rp2040
to drive the ATtiny817 Seesaw Breakout board, with a speaker on pin 13.

It makes a sound but the frequency does not change.

Read the original on github.com ↗