Note

Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.

Why Join?

  • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.

  • Learn & Share: Exchange tips and tutorials to enhance your skills.

  • Exclusive Previews: Get early access to new product announcements and sneak peeks.

  • Special Discounts: Enjoy exclusive discounts on our newest products.

  • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.

๐Ÿ‘‰ Ready to explore and create with us? Click [here] and join today!

2.5 Drum Kit๏ƒ

For this project, letโ€™s make a drum kit with three buttons and a slide switch. Now, play your own drums.

Wiring

drum_kit0

  • When the slide switch is toggled to the right, GP12 is high; when toggled to the left, GP12 is low.

  • Each of the three buttons is connected to a pull-down resistor, GP13~GP15 are low by default; when the button is pressed, GP13~GP15 are high.

Code

Note

  • You can refer to the image below to write code by dragging and dropping.

  • Import 2.5_drum_kit.png from the path of euler-kit\piper. For detailed tutorials, please refer to Import the Code.

drum_kit

After connecting Pico, click the Start button and the code starts to run. Pressing different buttons or toggling the slide switch will produce different drum sounds, just like a drum kit.

Note

If you are using a computer, you will need to plug in headphones or audio to your computer to hear the sound emitted.