> For the complete documentation index, see [llms.txt](https://learn.pakronics.com.au/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.pakronics.com.au/halocode-1/code-with-mu-a-simple-python-editor/examples/workshop/pedometer.md).

# Pedometer

![](/files/-LpgALBn5yEyTx-PMEXs)

**Program HaloCode**

1\. Create 3 pieces of message: "start", "move", and "stop"

![](/files/-LpgALBo0bsEX2rFM0c4)

2\. Add an Events block when button is pressed , a Control block repeat, another Events block broadcast (start), and a Sensing block reset timer

![](/files/-LpgALBpzGSIJAltkoNE)

3\. Add a Control block if () else (), an Operators block () > (), a Sensing block shaking strength, and an Events block broadcast (move). Input "15" to the second box of the Operators block

![](/files/-LpgALBquytXulVd-Z8N)

4\. Add a Control block if () then (), an Operators block () = (), a Sensing block shaking strength, and an Events block broadcast (stop)

![](/files/-LpgALBrfw2A6qqaw6b9)

5\. Add a Control block repeat until (), an Operators block () > (), and a Sensing block timer. Input "100" to the second box of the Operators block, and combine the two scripts

![](/files/-LpgALBsWOv2LhJNJUpz)

**Add a sprite**

6\. Delete default sprite Panda

![](/files/-LpgALBty5Jd2WWM-QcO)

7\. Add sprite "Empty"

![](/files/-LpgALBu7P-A4IhfoVq_)

8\. Choose "Empty", and then click "Costume". Draw a red dot

![](/files/-LpgALBv8hy1vU6ZvaZ-)

9\. Duplicate "Empty", and then change the costume to make a blue dot

![](/files/-LpgALBwzZ8R67TNBe5K)

10\. At the bottom of the Blocks Area, click "+ extension" to add Pen

![](/files/-LpgALBxOc8TLU_-Uhjh)

**Program the red dot**

11\. Make sure the red dot is selected, and then click Variables blocks. Create a new variable "motion value"

![](/files/-LpgALByQmbDhxzU8qO4)

12\. Add an Events block when I receive (move), and a Control block repeat () times. Input "4"

![](/files/-LpgALBzmLPmgWP99zBA)

13\. Add a Motion block turn ↷ () degrees , and a Pen block stamp, and a Variables block change (Motion value) by (1)

![](/files/-LpgALC-vDOaN5aRnZuU)

14\. Add an Events block when I receive (start), and a Motion block point in direct (90)

![](/files/-LpgALC05BTx54zIpYvQ)

**Program the blue dot**

15\. Make sure the red dot is selected, and then click Variables blocks. Create a new variable "Slitting value"

![](/files/-LpgALC1RU_NUfer6u4-)

16\. Add an Events block when I receive (stop), and a Control block repeat () times. Input "2"

![](/files/-LpgALC2IbmL730huRYK)

17\. Add a Motion block turn ↷ () degrees , and a Pen block stamp, and a Variables block change (Slitting value) by (1)

![](/files/-LpgALC3NznIwH9ANtg3)

18\. Add an Events block when I receive (start), and a Motion block point in direct (90)

![](/files/-LpgALC4QaqvAbyS2EwG)
