8. Case 06: Trebuchet
To build a trebuchet.
8.3. Background Knowledge
8.4. Bricks build-up
A detailed assembly instruction can be downloaded via the below links: Githubdownload
Click “Advanced” in the MakeCode drawer to see more choices.
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.
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.
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.
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.
You can also download it directly below:
While button A being pressed, the trebuchet executes the launch order and will return to its original launch status automatically.