Case 65: Drum Beater
69. Case 65: Drum Beater#
Use Nezha 48 IN 1 Inventor’s Kit and trimpotto build the drum machine that can control the speed with a knob.
69.2. Case building#
The structure is built as shown in the figure.
69.3. Connection Diagram#
Connect the trimpot to J1 port, and the Motor to M1 port on Nezha Breakout Board .
69.4. MakeCode Programming#
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.
Write the program as picture suggests#
You may also download it directly:
The knob trimpot allows you to control the rhythm of the drummer’s strikes.