Skip to content

Thonny crashes when using a speaker and a button #25

Closed
@MarcScott

Description

@MarcScott

Code

def play_passive_buzzer_with_button():
    '''play buzzer when buttone pressed'''
    from picozero import Button, Speaker
    button = Button(28)
    buzzer = Speaker(16)
    while True:
        button.when_pressed = lambda: buzzer.play(2000)
        button.when_released = lambda: buzzer.off()

Expected

Silent until button is pushed

Result

Sound plays instantly, then changes to 2000Hz on button push, at which point Thonny crashes.

Probably related to #24

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions