5. Case 01:The Mechanical Shrimp#

5.1. Introduction#

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

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

5.2. Quick to Start#

Materials Required#

Nezha Inventor’s Kit

Assembly#

Components List

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

Build it as the assembly steps suggest:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Connection Diagram#

Connect the Ultrasonic Sensor to J1, the geekservo to S1 and the two motors to M1 and M4 on Nezha Breakout Board.

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

5.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-37-07.png

Reference#

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

You may also download it directly:

Result#

After powering on, the mechanical shrimp moves forward and waves the princers, it will turn the directions if there is obstacles being detected. ../../_images/case_0101.gif