50. Case 46:Rangefinder Guitar¶
50.1. Introduction¶
Build a rangefinder guitar with the Nezha Inventor’s Kit.
50.2. Quick to Start¶
Materials Required¶
Connection Diagram¶
Connect the Ultrasonic sensor to J1 on Nezha Breakout Board.
50.3. MakeCode Programming¶
Step 1¶
Click “Advanced” in the MakeCode drawer to see more choices.
For programming Ultrasonic sensor, we need to add a package. Search with ”PlanetX“, in the dialogue box and click to download it.
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¶
Result¶
By detecting the distance between the ultrasonic sensor and the baffle, the buzzer is controlled to emit different tones.