44. Case 40:The Mechanical Motorcycle#

44.1. Introduction#

Build a mechanical motorcycle with the Nezha Inventor’s Kit.

../../_images/40_1.png

44.2. Quick to Start#

Materials Required#

Nezha Inventor’s Kit

Assembly#

Components List

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

Build it as the pictures suggest:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

We can see that the construction is completed as shown in the following figure:

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

Connection Diagram#

Connect the the geekservo to S1 and the motors to M1 on Nezha Breakout Board.

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

44.3. 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 Nezha Breakout Board, we need to add a package. Search with “Nezha” in the dialogue box and click 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#

Code as the picture suggests#

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

Reference#

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

You may also download it directly:

---

Result#

When the button A is pressed, the motorcycle turns left; when the button B is pressed, it drives to the right; and when the buttons A and B are pressed at the same time, the motorcycle stops driving.

../../_images/40_40.gif