Migrate docs from the other repo

This commit is contained in:
Michal Moskal
2016-03-25 16:47:20 -07:00
parent 38d2cf06d2
commit a08eb53f92
895 changed files with 36888 additions and 0 deletions

View File

@ -0,0 +1,45 @@
# zoomer block activity
Measure the acceleration on the micro:bit in the "z" direction.
### ~avatar avatar
### @video td/videos/zoomer-0
### ~
To create a new script, go to the [Create Code](/microbit/create-code) page and tap `New Project` under `Block Editor`.
Welcome! This activity will teach how to measure the acceleration on the micro:bit in the "z" direction. Let's get started!
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
Excellent, you're ready to continue with the [challenges](/microbit/lessons/zoomer/challenges)!
### ~

View File

@ -0,0 +1,37 @@
# zoomer blocks challenges
Coding challenges for zoomer.
## Before we get started
Complete the following [activity](/microbit/lessons/zoomer/activity) and your finished code should look like this:
```blocks
basic.forever(() => {
let az = input.acceleration(Dimension.Z)
basic.showNumber(az)
})
```
### Challenge 1
### @video td/videos/zoomer-2
We'll modify the code to display the `x` acceleration if the `A` button is pressed. For that, we need to store `acceleration (x)` in a new variable `ax` and use a `button (A) is pressed` to detect if the button is pressed.
```blocks
basic.forever(() => {
let az = input.acceleration(Dimension.Z)
let ax = input.acceleration(Dimension.X)
if (input.buttonIsPressed(Button.A)) {
basic.showNumber(ax)
}
basic.showNumber(az)
})
```
* Run the code to see if it works as expected.
### Challenge 2
Display the `y` acceleration when `B` is pressed by adding another `if` statement using `button (B) is pressed`.