71. Case 67: The Blocks Emitter#

71.1. Introduction#

Use Nezha 48 IN 1 Inventor’s Kit and Potentiometer to make a blocks emitter that can control the firing frequency with a knob and can be loaded automatically.

../../_images/neza-inventor-s-kit-case-67-01.png

71.2. Case Building#

Materials Required#

Nezha 48 IN 1 Inventor’s Kit

Potentiometer

Rubber bands

Assembly#

Parts list

../../_images/neza-inventor-s-kit-case-67-02.png

The structure is built as shown in the figure:

../../_images/neza-inventor-s-kit-step-67-01.png

../../_images/neza-inventor-s-kit-step-67-02.png

../../_images/neza-inventor-s-kit-step-67-03.png

../../_images/neza-inventor-s-kit-step-67-04.png

../../_images/neza-inventor-s-kit-step-67-05.png

../../_images/neza-inventor-s-kit-step-67-06.png

../../_images/neza-inventor-s-kit-step-67-07.png

../../_images/neza-inventor-s-kit-step-67-08.png

../../_images/neza-inventor-s-kit-step-67-09.png

../../_images/neza-inventor-s-kit-step-67-10.png

../../_images/neza-inventor-s-kit-step-67-11.png

../../_images/neza-inventor-s-kit-step-67-12.png

../../_images/neza-inventor-s-kit-step-67-13.png

../../_images/neza-inventor-s-kit-step-67-14.png

../../_images/neza-inventor-s-kit-step-67-15.png

../../_images/neza-inventor-s-kit-step-67-16.png

../../_images/neza-inventor-s-kit-step-67-17.png

../../_images/neza-inventor-s-kit-step-67-18.png

../../_images/neza-inventor-s-kit-step-67-19.png

../../_images/neza-inventor-s-kit-step-67-20.png

../../_images/neza-inventor-s-kit-step-67-21.png

../../_images/neza-inventor-s-kit-step-67-22.png

../../_images/neza-inventor-s-kit-step-67-23.png

../../_images/neza-inventor-s-kit-step-67-24.png

../../_images/neza-inventor-s-kit-step-67-25.png

../../_images/neza-inventor-s-kit-step-67-26.png

../../_images/neza-inventor-s-kit-step-67-27.png

../../_images/neza-inventor-s-kit-step-67-28.png

../../_images/neza-inventor-s-kit-step-67-29.png

../../_images/neza-inventor-s-kit-step-67-30.png

../../_images/neza-inventor-s-kit-step-67-31.png

../../_images/neza-inventor-s-kit-step-67-32.png

../../_images/neza-inventor-s-kit-step-67-33.png

../../_images/neza-inventor-s-kit-step-67-34.png

../../_images/neza-inventor-s-kit-step-67-35.png

../../_images/neza-inventor-s-kit-step-67-36.png

../../_images/neza-inventor-s-kit-step-67-37.png

After the construction is completed, as shown in the following figure:

../../_images/neza-inventor-s-kit-step-67-38.png

Connection Diagram#

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

../../_images/neza-inventor-s-kit-case-65-03.png

71.3. MakeCode Programming#

Step1#

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. Search with “PlanetX” in the dialog box to 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. Search with “Nezha” in the dialog box to download it.

../../_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 the picture suggests#

../../_images/neza-inventor-s-kit-case-65-07.png

Reference#

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

You may also download it directly:

Result#

The potentiometer allows you to control the firing frequency of the blocks emitter.

../../_images/neza-inventor-s-kit-case-67.gif