adafruit / adafruit/Adafruit_CircuitPython_seesaw

Variable Frequency PWM for ATtiny8x7 Seesaw Breakout

Open
#89 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
68
Forks
37
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the PWMOut object and its frequency property implementation for the ATtiny8x7 Seesaw Breakout, then reproduce the supplied sweep_down example using the speaker on pin 13. Check how frequency updates are sent to the breakout and verify that a sweep from 2000 Hz to about 80 Hz produces changing tones before silence.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.