pxt-calliope/docs/lessons/zoomer/activity.md

44 lines
915 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# zoomer block activity
2016-11-02 01:44:37 +01:00
Measure the acceleration on the @boardname@ in the "z" direction.
2016-03-26 00:47:20 +01:00
## ~avatar avatar
2016-03-26 00:47:20 +01:00
2016-05-27 00:24:10 +02:00
2016-03-26 00:47:20 +01:00
## ~
2016-03-26 00:47:20 +01:00
2016-11-02 01:44:37 +01:00
Welcome! This activity will teach how to measure the acceleration on the @boardname@ in the "z" direction. Let's get started!
2016-03-26 00:47:20 +01:00
We want to display the acceleration forever. In order to do so, we need a `forever` loop.
```blocks
basic.forever(() => {
})
```
Let's measure the acceleration and then store in it a variable `az`. The acceleration is measured in **milli-gravities**, so a value of `-1000` is equivalent to `-1g` or `-9.81m/s^2`.
```blocks
basic.forever(() => {
let az = input.acceleration(Dimension.Z)
})
```
Show the value of `az` on the screen.
```blocks
basic.forever(() => {
let az = input.acceleration(Dimension.Z)
basic.showNumber(az)
})
```
## ~avatar avatar
2016-03-26 00:47:20 +01:00
2016-04-13 17:27:45 +02:00
Excellent, you're ready to continue with the [challenges](/lessons/zoomer/challenges)!
2016-03-26 00:47:20 +01:00
## ~
2016-03-26 00:47:20 +01:00