jacdac.buzzer

Submodules

Package Contents

Classes

BuzzerClient

A simple buzzer.

class jacdac.buzzer.BuzzerClient(bus: jacdac.bus.Bus, role: str)

Bases: jacdac.bus.Client

A simple buzzer. Implements a client for the Buzzer service.

property volume: float | None

The volume (duty cycle) of the buzzer., _: /

play_tone(period: int, duty: int, duration: int) None

Play a PWM tone with given period and duty for given duration. The duty is scaled down with volume register. To play tone at frequency F Hz and volume V (in 0..1) you will want to send P = 1000000 / F and D = P * V / 2.

play_note(frequency: int, volume: float, duration: int) None

Play a note at the given frequency and volume.