zt07elecfreaks 发表于 2018-1-16 18:38:34

Make a Pedometer with Micro:bit

Introduction

Micro:bit has integrated accelerometer on the board. With this accelerometer, we can realize pedometer function by shaking our hands. If we combine it with a button battery, then a simple pedometer is created!
https://i.imgur.com/gmtzCUM.jpg


Tools&Materials:

1 x ELECFREAKS Power:bit For Micro:bit
1 x BBC Micro:bit Board for Coding & Programming
1 x Acrylic Base Board
1 x Watch band
7 x 3*5 Screws


Hardware Introduction

ELECFREAKS Power:bit is a kind of micro:bit extension board with minimum size. It is powered by two 2025/2032 button batteries and carries a buzzer on the board.
You can refer to the picture below to cut your acrylic board.
https://www.elecfreaks.com/wp-content/uploads/2018/01/RN4EB6VUVFXPD9C0PEM.png


How to Make

Firstly, fix your micro:bit onto power:bit.
https://www.elecfreaks.com/wp-content/uploads/2018/01/IMG_20180116_163351.jpg
https://www.elecfreaks.com/wp-content/uploads/2018/01/IMG_20180116_163402.jpg
Then use 2 screws to fix the acrylic base board onto power:bit.
https://www.elecfreaks.com/wp-content/uploads/2018/01/IMG_20180116_163546.jpg


Programming

Click to open Microsoft Makecode, write your code in the editor area.
Click Edit in the upper right corner to edit your program, then click Download in the bottom to save your code into micro:bit.



Code Explain

Set start image and initialize the count.
https://www.elecfreaks.com/wp-content/uploads/2018/01/L0HIWUAI_G0AJIN8Z@HD.png
When a vibration is detected, the count number will increase 1.https://www.elecfreaks.com/wp-content/uploads/2018/01/Q0WHKC6@HWUWFYU3V94V.png
Press button A to display the count number of your foot steps.
https://www.elecfreaks.com/wp-content/uploads/2018/01/EMS9AID2K3G_1XWXZ9.png


Succeed

Now you have create a pedometer by your own. Let's try it!


https://www.elecfreaks.com/12298.html
页: [1]
查看完整版本: Make a Pedometer with Micro:bit