Skip to main content

Case 65: Drum Beater

Introduction

Use Nezha 48 IN 1 Inventor's Kit and trimpotto build the drum machine that can control the speed with a knob.

Case building

Materials Required

Nezha 48 IN 1 Inventor's Kit

trimpot

Structure Construction

Parts List

The structure is built as shown in the figure.

Finished picture:

Connection Diagram

Connect the trimpot to J1 port, and the Motor to M1 port on Nezha Breakout Board .

MakeCode Programming

Step 1

Click “Advanced” in the MakeCode drawer to see more choices.

For programming the potentiometer, we need to add an extension library. Type "PlanetX" in the dialog box and click Search, then click Download this library.

For programming the Nezha expansion board, we need to add an expansion library. Type "Nezha" in the dialog box and click Search, then click to download this code library.

Notice: If you met a tip indicating that some codebases would be deleted due to incompatibility, you may continue as the tips say or create a new project in the menu.

Step 2

Write the program as picture suggests

Reference

Link: https://makecode.microbit.org/_L7shxbLtVJYY

You may also download it directly:

Result

The knob trimpot allows you to control the rhythm of the drummer's strikes.