Lol, no, you can't power a 2W amplifier off a GPIO pin ;-)
Use a P-Channel MOSFET to switch it
Source to +3.3v, drain to the Vcc pin on amplifier, 10k pullup from gate to source, and gate connected to GPIO pin, drive low to turn on. I was not able to find any through-hole p-channel mosfets with acceptable performance at -3.3Vgs - though in SOT-23 they are cheap and plentiful - and you're using an original Espruino board, so you can plop a SOT-23 fet down in the prototyping area.
Ya, the prototyping area changed my calculus. I'd thought about (and written) using N-channel because of the more available throughhole fet, but then I remembered that prototyping area.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Lol, no, you can't power a 2W amplifier off a GPIO pin ;-)
Use a P-Channel MOSFET to switch it
Source to +3.3v, drain to the Vcc pin on amplifier, 10k pullup from gate to source, and gate connected to GPIO pin, drive low to turn on. I was not able to find any through-hole p-channel mosfets with acceptable performance at -3.3Vgs - though in SOT-23 they are cheap and plentiful - and you're using an original Espruino board, so you can plop a SOT-23 fet down in the prototyping area.
Ya, the prototyping area changed my calculus. I'd thought about (and written) using N-channel because of the more available throughhole fet, but then I remembered that prototyping area.
I wrote in more detail in this - http://www.espruino.com/mosfets - hopefully that'll be helpful.