haroldpulcher wrote:In general driving a load from a GPIO pin by raising it high is bad practice.
If you want to use the GPIO pin directly without the output buffer mentioned, you should make that sync to ground. This means setting the pin low to turn on the buzzer. The GPIO pin can sync lots of current to ground, where it can only provide very little.
This is the generally accepted practice.
The hardware first guys usually make connections this way. Us software first guys like to assign on == high, and off == low because that is how we generally think about such things.
Notice how the hardware guys do not refer to anything as "on" or "off", but "active low" or "active high". This denotes at which state the device connected will "turn on" for lack a better term.
this may be general practice for most microcontrollers, but IMHO it is NOT valid for the GPIO's of the raspberry PI, which have push-pull drivers that can pull-down as hard as they can push-up, namely to a maximum of 15mA per GPIO pin (both when sinking and when sourcing current).
but yeah, don't try to connect any serious load to a GPIO, its not designed for that, when (for example) you want to sound a buzzer, then use a GPIO to control a transistor, which switches the buzzer on or off.