1단계: 만들어 보세요.
마이크로비트 만보계를 자신의 걷기 스타일에 맞추어 더 정확하게 만들 수 있습니다.
What you’ll learn
- How the micro:bit can collect numerical acceleration data
- How to apply thresholds to sensor data to trigger events like increasing a step counter
- The Step counter and Low energy step counter projects use the ‘shake’ gesture to count steps. The 'shake' gesture uses several accelerometer sensor readings to decide if the micro:bit has been shaken.
- You may find that the ‘shake’ gesture isn’t triggered every time you take a step, or that it’s triggered too easily, leading to inaccurate counting of steps.
- To make a more accurate step counter, instead of using the ‘shake’ gesture, this program uses numerical data from the accelerometer to decide whether you’ve taken a step and, if you have, increase the steps variable by 1.
- If the acceleration is greater than (>) 1500, the steps variable is increased by one and show the step count on the LED display output. 1500 is the threshold – the point at which a movement will trigger a step to be counted.
- You may need to change the 1500 number to make the step counter more accurate – but you can decide what threshold to use, whereas with the ‘shake’ gesture the threshold has been decided for you by the people who designed the micro:bit.
- Modifying the threshold to work for you is called calibration.
- Note that when micro:bit is not moving, the accelerometer gives a strength reading of about 1000. This is caused by the Earth’s gravity pulling down on the micro:bit.
- 마이크로비트 (또는 MakeCode 시뮬레이터)
- MakeCode 또는 Python 편집기
- AAA 배터리 팩 (옵션)
- something to attach the micro:bit to your shoe or leg – string or Velcro.
2단계: 프로그래밍 해보세요.
3단계: 더 좋게 만들어 보세요.
- Make your batteries last longer by changing the program so it only shows the number of steps when you press button A.
- B 버튼을 누르면, 걸음 횟수를 0 으로 초기화 할 수 있도록 바꿔 보세요.
- 걸음 횟수를 측정한 후, 자신이 이동한 거리를 계산해 보세요. 걸음 횟수에 한 걸음 만큼의 길이를 곱하면 됩니다.
- The accelerometer can measure forces in 3 dimensions, called the X, Y and Z axes. You can modify the code to choose which axis to measure, depending on which way up you fix your micro:bit to your leg or shoe.