Back to Activity
Tutorial
Advanced Pickup game
{% trans 'Sorry, your browser does not support canvas -- please either update your browser or submit your requirements by phone or email.' %}

Accelerometer

Loading Blockly...

Step 1 /6

Introduction

You have been provided with an extended version of the previous code. You will now learn how to finish the code for an operation game that can detect 4 different object fails.

Click on the cog at the top right of CodeBug.

Tick the Show leg controls box.

Click Apply button.

Step 2 /6

Configure leg

Configure CodeBug’s legs 2 and 3 to be inputs.

Click the cog on your start block.

In the window that appears, tick the checkboxes next to leg 2 input/output and leg 3 input/output.

Click the cog again to close the window.

Step 3 /6

Set to input

We want to set legs 0, 1, 2 and 3 to inputs, click the drop down menus on the start block so you have all the legs set to digital input.

Step 4 /6

More If blocks

You can see the code provided has two if blocks with scrolling text inside. You need to make another two if blocks in just the same way. Put them below the first two if blocks. Make sure you change the leg numbers to 2 and 3. Change the message that is scrolled for each of your new if blocks.

Step 5 /6

Run your code

Click the Play button to run your code. A message will scroll when the corresponding leg is clicked.

Step 6 /6

Download your code

Click the Download button to download your program.