47. Case 46:Rangefinder Guitar#

47.1. Introduction#

Build a rangefinder guitar with the Nezha Inventor’s Kit.

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

47.2. Quick to Start#

Materials Required#

Nezha Inventor’s Kit

Assembly#

Components List

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

Build it as the assembly steps suggest:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Connection Diagram#

Connect the Ultrasonic sensor to J1 on Nezha Breakout Board.

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

47.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 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

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-46-07.png

Reference#

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

You may also download it directly:

Result#

By detecting the distance between the ultrasonic sensor and the baffle, the buzzer is controlled to emit different tones.