9. Case 06: Trebuchet#

9.1. Purpose#

To build a trebuchet.

../../_images/Ringbit_Bricks_Pack_case_en_06_01.png

9.3. Materials#

../../_images/Ringbit_Bricks_Pack_case_en_06_02.png

9.4. Background Knowledge#

9.5. Bricks build-up#

../../_images/Ringbit_Bricks_Pack_step_06_00.png

../../_images/Ringbit_Bricks_Pack_step_06_01.png

../../_images/Ringbit_Bricks_Pack_step_06_02.png

../../_images/Ringbit_Bricks_Pack_step_06_03.png

../../_images/Ringbit_Bricks_Pack_step_06_04.png

../../_images/Ringbit_Bricks_Pack_step_06_05.png

../../_images/Ringbit_Bricks_Pack_step_06_06.png

../../_images/Ringbit_Bricks_Pack_step_06_07.png

../../_images/Ringbit_Bricks_Pack_step_06_08.png

../../_images/Ringbit_Bricks_Pack_step_06_09.png

../../_images/Ringbit_Bricks_Pack_step_06_10.png

../../_images/Ringbit_Bricks_Pack_step_06_11.png

../../_images/Ringbit_Bricks_Pack_step_06_12.png

../../_images/Ringbit_Bricks_Pack_step_06_13.png

../../_images/Ringbit_Bricks_Pack_step_06_14.png

../../_images/Ringbit_Bricks_Pack_step_06_15.png

../../_images/Ringbit_Bricks_Pack_step_06_16.png

../../_images/Ringbit_Bricks_Pack_step_06_17.png

../../_images/Ringbit_Bricks_Pack_step_06_18.png

../../_images/Ringbit_Bricks_Pack_step_06_19.png

../../_images/Ringbit_Bricks_Pack_step_06_20.png

../../_images/Ringbit_Bricks_Pack_step_06_21.png

../../_images/Ringbit_Bricks_Pack_step_06_22.png

../../_images/Ringbit_Bricks_Pack_step_06_23.png

../../_images/Ringbit_Bricks_Pack_step_06_24.png

../../_images/Ringbit_Bricks_Pack_step_06_25.png

../../_images/Ringbit_Bricks_Pack_step_06_26.png

../../_images/Ringbit_Bricks_Pack_step_06_27.png

../../_images/Ringbit_Bricks_Pack_step_06_28.png

../../_images/Ringbit_Bricks_Pack_step_06_29.png

../../_images/Ringbit_Bricks_Pack_step_06_30.png

../../_images/Ringbit_Bricks_Pack_step_06_31.png

../../_images/Ringbit_Bricks_Pack_step_06_32.png

../../_images/Ringbit_Bricks_Pack_step_06_33.png

../../_images/Ringbit_Bricks_Pack_step_06_34.png

../../_images/Ringbit_Bricks_Pack_step_06_35.png

../../_images/Ringbit_Bricks_Pack_step_06_36.png

../../_images/Ringbit_Bricks_Pack_step_06_37.png

../../_images/Ringbit_Bricks_Pack_step_06_38.png

../../_images/Ringbit_Bricks_Pack_step_06_39.png

../../_images/Ringbit_Bricks_Pack_step_06_40.png

../../_images/Ringbit_Bricks_Pack_step_06_41.png

../../_images/Ringbit_Bricks_Pack_step_06_42.png

../../_images/Ringbit_Bricks_Pack_step_06_43.png

../../_images/Ringbit_Bricks_Pack_step_06_44.png

../../_images/Ringbit_Bricks_Pack_step_06_45.png

../../_images/Ringbit_Bricks_Pack_step_06_46.png

../../_images/Ringbit_Bricks_Pack_step_06_47.png

A detailed assembly instruction can be downloaded via the below links: Githubdownload

9.6. Software#

MicroSoftmakecode

9.7. Code#

Step 1#

Click “Advanced” in the MakeCode drawer to see more choices.

../../_images/Ringbit_Bricks_Pack_case_en_06_03.png

In order to programme for the Ring:bit Bricks Pack, we need to add an extension. Click “Extensions” at the bottom of the drawer. Search “servo” in the dialogue box to download it.

../../_images/Ringbit_Bricks_Pack_case_en_06_04.png

Note: If you met a tip indicating codebase will be deleted due to incompatibility, you may continue as the tips tell or build a new project.

Step 2#

While button A being pressed, set the servo connected to P1 port turning 180 degrees and pause 300ms; then set the same port turning 90 degrees and pause 1000ms; set the servo connected to P2 turning 0 degree and pause 1000ms; then the same port turning 90 degrees and pause 1000ms; P1 turning 0 degree and pause 300ms; then the same port turning 90 degrees and pause 500ms; P2 turning 180 degrees and pause 1000ms and the same port turning 90 degrees and pause 1600ms.

../../_images/Ringbit_Bricks_Pack_case_en_06_05.png

Note: As the servo we used is in 360 degrees, the “servo” extension in MakeCode is suitable for servos in 180 degrees, therefore, setting the turning angle to 0 degree or 180 degrees will lead to the servo turning clockwisely or anti-clockwisely, and 90 degrees means to stop turning.

Code#

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

You can also download it directly below:

Result#

While button A being pressed, the trebuchet executes the launch order and will return to its original launch status automatically.

9.8. Exploration#

9.9. FAQ#

9.10. Relevant File#