Introduction: Step Counter - Micro:Bit

About: Check out my TikTok!

This project will be a step counter. We will use the accelerometer sensor that is built in to the Micro:Bit to measure our steps. Each time the Micro:Bit shakes we will add 2 to the count and display it on the screen.

Supplies

- Yourself

- Micro:Bit

- Battery Pack

- Mirco USB

- Computer

Step 1: Start New Project

Click the following link to start a new project. You can delete any blocks that are already there.

Step 2: Add Shake Block

Add the shake block. Whatever goes inside this block will execute whenever you shake the Micro:Bit.

Step 3: Create Variable

Go to variables and click "create a variable". Name it whatever you want, just keep track of the name. I named mine "Counter", because that is what it will be doing!

A variable is like a storage box in memory. You can name your variables. That way whenever you use the name in your program, it shows what is in the box.

Step 4: Increment Variable

Add a block to change the value inside your variable after shaking. I have mine set to increment (add) by 2 every time you shake the Micro:bit.

This way it will count 2 steps each time my foot that it is on touches the ground.

Step 5: Forever Loop

Next we add a forever loop. This is where we will put the block that displays the contents of our variable.

Step 6: Show Number

Add a show number block to the forever loop. This is where we will put our variable.

Step 7: Show Variable

Add your variable inside the show number block. Now the Micro:Bit will always show the number stored in your variable.

Step 8: Plug In

Plug your Micro:Bit into your computer using the micro USB cable.

Step 9: Download

Download the program to your computer and transfer it to your Micro:Bit.

If you are unclear on how to do this, I suggest following my Hack Your Headphones tutorial.

Step 10: Add Battery

Unplug your Micro:Bit from the computer and plug in your battery Pack. It should be displaying 0 after downloading the program.

Step 11: Add to Leg

Add the Micor:Bit to your leg. You may need duck tape or rubber bands to connect it.

Count your steps for the rest of the day! The American Heart Health Association recommends about 10,000 steps per day to stay healthy.

How far were you from 10,000 steps?

Did anything go wrong with this project?

How could it be improved if you did it over again?

Step 12: Here Are Video Instructions If You Prefer That! :)