Jump counter

Jump counter

In this example we program a jump counter with the Calliope mini.


15 mins

from 8 years on


Did you know that there are also sports watches that can count your jumps? The Calliope mini can do that too! But how does it work?
Exactly, with sensors! There are many tiny sensors in the sports watch and smartphone: Temperature sensor, light sensor, touch sensor, pressure sensor, motion sensor and an accelerometer.

On the Calliope mini you will find these sensors too. Which one can you use to count jumps?

Answer: The accelerometer

You can imagine sensors as sensory organs (ears, eyes etc.). With sensors, devices can feel their environment. They do this, for example, by measuring how warm it is around them, how close they are to an obstacle, or how loud a noise is.

1measure the acceleration

The Calliope mini measures the acceleration, i.e. your jumping, with its accelerometer.

It needs 3 directions: x, y, z.

When jumping, it's best to hold the Calliope mini in your hand like this.

In this project we use the MakeCode Editor popup: yes.

  • Delete your program or start a new one.
  • Select this block from the Input category:

Is something already happening? Or are some blocks still missing?

2Counting the jumps
  1. Click on this button in Variables:
  1. Click into the white field and write "jumpCounter". This is the new name of the variable.
  2. Click on OK.

Cool! Your jumpCounter is now in the category Variables!

You can think of a variable as a box in which you can put your toys - in computer language, this is called saving. The box is given a name so that what you put in it can later be found again. For us this is the measured value from jumping. The Calliope mini remembers this value and finds it again and again under this name. You can then simply read the measured value from the Calliope mini.


Now the Calliope mini should learn to count!

  • For this you need “forever” and
  • “if...then” from the category Logic:
  • Replace “true” with “0 < 0 from Logic:

Your program now compares the value the Calliope mini measures when you jump with the value when you don't jump.

  • Put the blocks together like this and change “x” to “y” and “<” to “>”:

Greater and lesser have to do with left/right positioning. The verbs ">" (greater than) and "<" (less than) are used to talk about this left/right ordering. The higher number stands on the site where the opening is. i am smaller < i am larger

  • Get “change item by 1” from Variables.
  • Change the word “item” to “jumpCounter”. You can do this by pressing the small arrow in the block and then clicking the word “item”.

Your program should look like this now!

Oops! The Calliope mini counts your jumps, but you don't notice anything of it...

  • Put a sound- block behind “then”, under “change jumpCounter”. The Calliope mini should now beep when he counts a jump.

Hmm,...something is wrong! Your Calliope mini beeps all the time, even if you don't jump!

4try it out

Oh, ...that's the reason: The Calliope mini even counts if you don't jump but just touch it! That's why you have to make this number waaay larger - around 2000 or so ...

Now only one thing is missing: You probably want to know how many jumps you have made!

  1. Search for “on button A pressed”:
2. Look for “show number” and “jumpCounter” and put them together with “on button A pressed”.

The Calliope mini now shows you at the push of button A your result: the number of jumps.

Additional task
Improve your program even more. Use button B to set the value of the variable “jumpCounter” to 0. Otherwise you'll always have to turn off the Calliope mini to start counting jumps again.

Done! You programmed a jump counter. Congratulations!

This text as well as the images are published under a CC BY-SA 3.0 DE license popup: yes. It was originally published in German popup: yes by InfoSphere popup: yes and translated into English by the Calliope team.