# Case 65: Drum Beater ## Introduction Use **[Nezha 48 IN 1 Inventor's Kit](https://shop.elecfreaks.com/products/elecfreaks-micro-bit-nezha-48-in-1-inventors-kit-without-micro-bit-board?_pos=2&_sid=ed1b6fbd2&_ss=r)** and [trimpot](https://shop.elecfreaks.com/products/elecfreaks-planetx-trimpot-sensor?_pos=1&_sid=5a8a7f5cf&_ss=r)to build the drum machine that can control the speed with a knob. ![](./images/neza-inventor-s-kit-case-65-01.png) ## Case building ### Materials Required **[Nezha 48 IN 1 Inventor's Kit](https://shop.elecfreaks.com/products/elecfreaks-micro-bit-nezha-48-in-1-inventors-kit-without-micro-bit-board?_pos=2&_sid=ed1b6fbd2&_ss=r)** [trimpot](https://shop.elecfreaks.com/products/elecfreaks-planetx-trimpot-sensor?_pos=1&_sid=5a8a7f5cf&_ss=r) ### Structure Construction Parts List ![](./images/neza-inventor-s-kit-case-65-02.png) The structure is built as shown in the figure. ![](./images/neza-inventor-s-kit-step-65-01.png) ![](./images/neza-inventor-s-kit-step-65-02.png) ![](./images/neza-inventor-s-kit-step-65-03.png) ![](./images/neza-inventor-s-kit-step-65-04.png) ![](./images/neza-inventor-s-kit-step-65-05.png) ![](./images/neza-inventor-s-kit-step-65-06.png) ![](./images/neza-inventor-s-kit-step-65-07.png) ![](./images/neza-inventor-s-kit-step-65-08.png) ![](./images/neza-inventor-s-kit-step-65-09.png) ![](./images/neza-inventor-s-kit-step-65-10.png) ![](./images/neza-inventor-s-kit-step-65-11.png) ![](./images/neza-inventor-s-kit-step-65-12.png) ![](./images/neza-inventor-s-kit-step-65-13.png) ![](./images/neza-inventor-s-kit-step-65-14.png) ![](./images/neza-inventor-s-kit-step-65-15.png) ![](./images/neza-inventor-s-kit-step-65-16.png) ![](./images/neza-inventor-s-kit-step-65-17.png) ![](./images/neza-inventor-s-kit-step-65-18.png) ![](./images/neza-inventor-s-kit-step-65-19.png) ![](./images/neza-inventor-s-kit-step-65-20.png) ![](./images/neza-inventor-s-kit-step-65-21.png) ![](./images/neza-inventor-s-kit-step-65-22.png) ![](./images/neza-inventor-s-kit-step-65-23.png) ![](./images/neza-inventor-s-kit-step-65-24.png) ![](./images/neza-inventor-s-kit-step-65-25.png) Finished picture: ![](./images/neza-inventor-s-kit-step-65-26.png) ## Connection Diagram Connect the [trimpot](https://shop.elecfreaks.com/products/elecfreaks-planetx-trimpot-sensor?_pos=1&_sid=5a8a7f5cf&_ss=r) to J1 port, and the [Motor](https://shop.elecfreaks.com/products/elecfreaks-high-speed-building-blocks-motor?_pos=4&_sid=a2da3fff8&_ss=r) to M1 port on [Nezha Breakout Board](https://shop.elecfreaks.com/products/elecfreaks-nezha-breakout-board?_pos=1&_sid=00432325a&_ss=r) . ![](./images/neza-inventor-s-kit-case-65-03.png) ## MakeCode Programming ### Step 1 Click “Advanced” in the MakeCode drawer to see more choices. ![](./images/neza-inventor-s-kit-case-37-04.png) 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. ![](./images/neza-inventor-s-kit-case-37-05.png) 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. ![](./images/neza-inventor-s-kit-case-37-06.png) *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 ![](./images/neza-inventor-s-kit-case-65-07.png) ### Reference Link: [https://makecode.microbit.org/_L7shxbLtVJYY](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. ![](./images/neza-inventor-s-kit-case-65.gif)