-
Notifications
You must be signed in to change notification settings - Fork 52
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
Driving the speaker pin with hardware PWM produces only noise the first time #313
Comments
This is still replicable in v0.2.55. |
I can confirm this is still replicable with CODAL v0.2.57 |
The first call to setAnalogPeriodUs does nothing because the pin hasn't been configured as an analogue output. |
Thanks Martin! However, it makes sense for the user to want to set up the analog out configuration before changing the pin mode to start outputting the signal. |
Yes, I don't know why it doesn't call setAnalogValue(0) if the pin isn't already configured, but it might be awkward to remember the setting until setAnalogValue is called. The DAL would have to change too. It can't find an explicit mention in the CODAL source or Python docs, but it's there in DAL and MakeCode. |
Discussed with @finneyj and we should be able to configure analog settings before using the pin as an analog input/output, so we can consider this a bug to fix. With that in mind, this MicroPython issue is also related: |
This example programme produces a weird noise the first loop iteration, and the correct tone the others.
MICROBIT.hex.zip
The text was updated successfully, but these errors were encountered: