Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

music.pitch latches when music.stop occours on a different pin #661

Open
rhubarbdog opened this issue May 15, 2019 · 3 comments
Open

music.pitch latches when music.stop occours on a different pin #661

rhubarbdog opened this issue May 15, 2019 · 3 comments
Labels

Comments

@rhubarbdog
Copy link
Contributor

rhubarbdog commented May 15, 2019

I have this program which plays 440Hz on pin2. I stop pin0 with misic.stop(). The short note playing on pin2 latches.
latch03.py.txt

@dpgeorge
Copy link
Member

The music module can only handle playing music on one pin at a time, it's not supported to mix different pins in calls to play/pitch/stop/etc.

For the test script attached above, what happens is that the PWM is started on pin2 and then music.stop() stops the music subsystem and cancels the PWM on pin0. But pin2 continues to have PWM output on it and will never be turned off (unless it's used again) because the music subsystem is now idle.

I don't think anything really needs to be fixed here. Rather the docs could be updated to mention this, that you must use the same pin for all subsequent calls to the music module.

@dpgeorge dpgeorge added the docs label May 17, 2019
@rhubarbdog
Copy link
Contributor Author

Why isn't the 12 millisecond time not expiring on ubit.pin2?

@dpgeorge
Copy link
Member

Why isn't the 12 millisecond time not expiring on ubit.pin2?

Because when music.stop() is called it stops everything related to music, including the timeout for pin2. So there is never any event which stops PWM on pin2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants