Hi All,
I am working on a project which involves using an external speaker. The code has to be in makecode as this is part of a larger workshop. What I am trying to do is disable the onboard speaker (via code) while still maintaining the signal output on pin A0. I can currently achieve this by shorting the right most flash access pin (pin 11) to ground but really need to do this in software. I am not sure I need if I can write a custom Makecode block to do this. Any help on this front would be appreciated.
Thanks
Disable Speaker but keep audio signal on A0 in Makecode
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- nposenr
- Posts: 3
- Joined: Wed Jan 19, 2022 6:52 pm
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Disable Speaker but keep audio signal on A0 in Makecode
Are you using a Circuit Playground Express board or another model?
This could only be for micro:bit, but here is how it does there:
https://makecode.microbit.org/reference ... er-enabled
This could only be for micro:bit, but here is how it does there:
https://makecode.microbit.org/reference ... er-enabled
- nposenr
- Posts: 3
- Joined: Wed Jan 19, 2022 6:52 pm
Re: Disable Speaker but keep audio signal on A0 in Makecode
I am using a Circuit Playground Express and cannot change to microbit. That is the exact functionality that I want but that block is not available for the CPX. I am also un able to track down the equivalent music.setBuiltInSpeakerEnabled(false) Javascript method for the CPX to write my own custom block even though PIN_SPEAKER_AMP = DAL.PA30; is defined in the CPX config.
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Disable Speaker but keep audio signal on A0 in Makecode
There is a:
which defaults to 128 and you could reduce to 0. Hardly ideal, but though I would mention that option.
There was an issue opened with the pxt-adafruit github repo. Someone was trying to do the same as you and disable the speaker and the PA30 AMP pin setting came up as well. Unfortunately, there is a MUX involved that makes turning off the internal speaker AMP more difficult than just pulling PA30 low.
https://github.com/Microsoft/pxt-adafruit/issues/138
Code: Select all
set volume <value>
There was an issue opened with the pxt-adafruit github repo. Someone was trying to do the same as you and disable the speaker and the PA30 AMP pin setting came up as well. Unfortunately, there is a MUX involved that makes turning off the internal speaker AMP more difficult than just pulling PA30 low.
https://github.com/Microsoft/pxt-adafruit/issues/138
- nposenr
- Posts: 3
- Joined: Wed Jan 19, 2022 6:52 pm
Re: Disable Speaker but keep audio signal on A0 in Makecode
Thanks for the feedback. the github post is interesting. Sadly setting volume to 0 does not work as it also sets the volume coming off of pin 0 and therefore we get no signal. The current solution that we are running is a piece of copper tape from the pad on the the back of the CPX to the ground pin. We may just have to stick with that.
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Disable Speaker but keep audio signal on A0 in Makecode
You might have to stick with the copper tape. You can also open a new issue if you like requesting an enhancement.
https://github.com/microsoft/pxt-adafruit/issues
https://github.com/microsoft/pxt-adafruit/issues
Please be positive and constructive with your questions and comments.