# Case 40:The Mechanical Motorcycle ## Introduction Build a mechanical motorcycle with the [Nezha Inventor's Kit](https://shop.elecfreaks.com/products/elecfreaks-micro-bit-nezha-48-in-1-inventors-kit-without-micro-bit-board?_pos=2&_sid=ed1b6fbd2&_ss=r). ![](./images/40_1.png) ## Quick to Start ### Materials Required [Nezha Inventor's Kit](https://shop.elecfreaks.com/products/elecfreaks-micro-bit-nezha-48-in-1-inventors-kit-without-micro-bit-board?_pos=2&_sid=ed1b6fbd2&_ss=r) ### 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](https://shop.elecfreaks.com/products/elecfreaks-360-degrees-building-blocks-servo?_pos=1&_psq=servo&_ss=e&_v=1.0) to S1 and the [motors](https://shop.elecfreaks.com/products/elecfreaks-high-speed-building-blocks-motor?_pos=4&_sid=a2da3fff8&_ss=r) to M1 on [Nezha Breakout Board](https://shop.elecfreaks.com/products/elecfreaks-high-speed-building-blocks-motor?_pos=4&_sid=a2da3fff8&_ss=r). ![](./images/neza-inventor-s-kit-case-40-03.png) ## 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](https://shop.elecfreaks.com/products/elecfreaks-high-speed-building-blocks-motor?_pos=4&_sid=a2da3fff8&_ss=r), 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](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)