40. Case 39:The Mechanical Crab#

40.1. Introduction#

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

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

40.2. Quick to Start#


Materials Required#

Nezha Inventor’s Kit

Assembly#


Components List

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

Build it as the assembly steps suggest:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Connection Diagram#

Connect the Ultrasonic Sensor to J1 and the motor to M1 on Nezha Breakout Board.

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

40.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 the Ultrasonic Sensor, we need to add a package. Search with “PlanetX” in the dialogue box and click to download it.

../../_images/neza-inventor-s-kit-case-37-05.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-39-07.png

Reference#

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

You may also download it directly:


Result#

After powering on, if the crab sees an approaching object ahead, it will crawl towards sideways.