Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
308 views

Microbit Block Programming Step Counter CF

This document provides step-by-step instructions for creating a step counter program using micro:bit block coding. The program uses a variable to store the step count, and increments the variable by 1 each time the micro:bit is shaken. It then displays the current step count on the micro:bit LED screen. The completed program is downloaded and transferred to the micro:bit device to be run independently of the computer.

Uploaded by

api-329048260
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
308 views

Microbit Block Programming Step Counter CF

This document provides step-by-step instructions for creating a step counter program using micro:bit block coding. The program uses a variable to store the step count, and increments the variable by 1 each time the micro:bit is shaken. It then displays the current step count on the micro:bit LED screen. The completed program is downloaded and transferred to the micro:bit device to be run independently of the computer.

Uploaded by

api-329048260
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Micro:bit Block Programming: Step Counter

1
2
Step 3: Get rid of the forever block.

Step 4: Create a variable by selecting and clicking

FYI: Variables are used in programs to store information that can change. In this
activity, it’s steps.

Step 5: Type the word steps in the box and


click ok.

Step 6: Find the [ ].

Step 7: Grab the block, drag and drop inside the [ ].

Your code should look like this:

3
Step 8: Now, let’s make something happen when we shake our micro:bit. So, find
the [ ] block from the input tab.

Step 9: Grab the block, drag and drop the block to the right of the on start block
in your workspace.

Your code should look like this:

Step 10: Locate the [ ] under the variables tab.

Step 11: Grab the block, drag and drop inside the [ ] block.

FYI: This will change the value of the steps variable by 1 every time the micro:bit
is shaken.

Your code should look like this:

4
Step 12: Find the [ ] block from the basic tab.

Step 13: Grab the block, drag and drop below [ ] block.

FYI: This will show the number on the LED display.

Your code should look like this:

Step 14: Find the [ ] variable under .

Step 15: Grab the block, drag and drop [ ]

HERE!!!

Your code should look like this:

Step 16: Continuously move the mouse pointer around on the simulator as if you are
shaking it. What happens?

FYI: You should see numbers appear on the LED display.

5
Let’s Download the Code

Step 17: In the box that says Untitled, rename the file “Step Counter.” Then
Download.

Step 18: Show File in Folder.

 The file will display in your Downloads folder as a hex file. Locate the
downloaded .hex file.

6
Step 19: Connect the micro:bit to your computer with a USB cable. The microUSB
port is on top of the micro:bit.

Step 20: Drag the .hex file from the Downloads folder to the MICROBIT drive.

The code is now downloaded to your micro:bit!

To use the micro:bit away from your computer, disconnect the micro:bit from the
USB cable and connect the battery pack.

You might also like