In this recipe, you will learn how to create a function that, when called, will enable the speaker. If you don't enable the speaker before audio playback, then it will be played through pin A0, which can have a headphone connected to it.
This project will use the speaker on the board instead of headphones, so we will need this function to enable the speaker at the start of our script. Beyond showing you how to enable the speaker, this recipe will also introduce you to ways of digitally controlling input/output pins.