Uploaded May 2015 | Updated September 2026, 14 hours ago
Just some simple fun with some simple code on an Uno. Tweak the values to play with the sound. I highly recommend NOT directly driving an 8-ohm speaker from an Arduino like this, though. It's not good for the pin. I just did this for a brief period. Really, you should put some additional resistance (maybe 500 ohms) between them. It won't be as loud, but you won't be in danger of breaking your Arduino.
Just some simple fun with some simple code on an Uno. Tweak the values to play with the sound. I highly recommend NOT directly driving an 8-ohm speaker from an Arduino like this, though. It's not good for the pin. I just did this for a brief period. Really, you should put some additional resistance (maybe 500 ohms) between them. It won't be as loud, but you won't be in danger of breaking your Arduino.










