Disable Speaker but keep audio signal on A0 in Makecode

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nposenr
 
Posts: 3
Joined: Wed Jan 19, 2022 6:52 pm

Disable Speaker but keep audio signal on A0 in Makecode

Post by nposenr »

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

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Disable Speaker but keep audio signal on A0 in Makecode

Post by mikeysklar »

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

User avatar
nposenr
 
Posts: 3
Joined: Wed Jan 19, 2022 6:52 pm

Re: Disable Speaker but keep audio signal on A0 in Makecode

Post by nposenr »

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.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Disable Speaker but keep audio signal on A0 in Makecode

Post by mikeysklar »

There is a:

Code: Select all

set volume <value>
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

User avatar
nposenr
 
Posts: 3
Joined: Wed Jan 19, 2022 6:52 pm

Re: Disable Speaker but keep audio signal on A0 in Makecode

Post by nposenr »

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.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Disable Speaker but keep audio signal on A0 in Makecode

Post by mikeysklar »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”