Music output on BraniPad

I’d like to compose a simple tune using MakeCode and the Brainpad. I can hear the tune from the BrainPad buzzer. I would like to output that to small speakers: 8 Ohm each, .5Watt each. They only have two leads, + and -. I have wires soldered onto the speaker pads , speakers are about the size of an American half dollar. This is a part of my MakeCode and fashion/music project for teen girls and will be making ear rings out of the speakers , first to place on a Barbie mannequin.

  1. Is there code where I can assign BrainPad output to each speaker. I don’t need stereo at this point. Which pins do I plug into on the BrainPad board or is a third, Data wire needed?

  2. Is there a place where I can find diagrams for wiring BrainPad , music outputs other than MakeCode editing which shows all music outputs going to the buzzer on the BP hardware ; I’d like to send my signal via on-board pins to speakers. Thanks

Well, on this one, I wired the + from the little speaker to TX pin and - to ground on the BrainPad. When I press the left button I do hear a click that the electric signal has been sent to speaker. And the two tones play but on the BrainPad buzzer not on the external speaker of course. So getting the ‘music’ code to output to via of the I/O pins is what I’m after if possible, thanks

Try using PWM?

You need to use the expansion headers to connect an basic amp and then a speaker. Ebay and sparkfun are examples of where to get an amp. You can also wire headphones to a pin directly without an amp. What I recommend is wiring a powered computer speakers. These have a built in amp. Once you have it working with the PC speakers then you can switch to whatever you like.

Now for the software, you need PWM like mike suggested. First, set analog to 512 to give you 50% duty cycle on a PWM and then use the set period to control the frequency. I haven’t tried this myself but I am curious so please share back your findings. Not all pins have PWM feature on them but I know for sure the pin labeled PWM does.