# Step Counter

![https://makecode.microbit.org/projects/step-counter](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-Ltev9Fvj-huUKcdOBA_%2F-LtevFcdMIsGSHwVmH0d%2Fimage.png?alt=media\&token=46068509-2e52-4468-9e85-ffda63542a3c)

Detecting a Step: Assuming the microbit is attached to a foot  or  an ankle it  will get shaken when it moves  - which means if we count the number of moves we should be counting (most) of the steps

```
steps = 0

On Shake
  steps = steps + 1
  
Forever
  show steps

```

**Tip**: are you noticing a lag between the actual number of steps taken and the value displayed? Remember  `step`  can change WHILE  `step` is being displayed.  To remove this lag,  add `stop  animation` each time the value of `step` is changed

