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,88 @@
# compass challenges
Display the direction that the BBC micro:bit is facing using the compass
## Before we get started
Complete the following guided tutorial:
* [tutorial](/microbit/lessons/compass/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
input.calibrate()
basic.forever(() => {
let degrees = input.compassHeading()
if (degrees < 45) {
basic.showString("N", 100)
} else if (degrees < 135) {
basic.showString("E", 100)
}
else if (degrees < 225) {
basic.showString("S", 100)
}
else {
basic.showString("W", 100)
}
})
```
### Challenge 1
Instead of displaying `N` when the BBC micro:bit is pointing North, display a star to indicate the north star.
```
input.calibrate()
basic.forever(() => {
let degrees1 = input.compassHeading()
if (degrees1 < 45) {
basic.plotImage(`
# . # . #
. # # # .
# # # # #
. # # # .
# . # . #
`) // ***
} else if (degrees1 < 135) {
basic.showString("E", 100)
}
else if (degrees1 < 225) {
basic.showString("S", 100)
}
else {
basic.showString("W", 100)
}
})
```
* Run your code to see if it works as expected
### Challenge 2
Instead of displaying just `N`, `W`, `S`, or `E`, display the full word.
```
input.calibrate()
basic.forever(() => {
let degrees2 = input.compassHeading()
if (degrees2 < 45) {
basic.showString("NORTH", 100) // ***
} else if (degrees2 < 135) {
basic.showString("EAST", 100) // ***
}
else if (degrees2 < 225) {
basic.showString("SOUTH", 100) // ***
}
else {
basic.showString("WEST", 100) // ***
}
})
```
* Run your code to see if it works as expected
### Challenge 3
Display your own unique message for each direction.

View File

@ -0,0 +1,56 @@
# compass quiz answers
Create an actual compass to show your direction: North, South, East, or West
## Name
## Directions
Use this activity document to guide your work in the [compass tutorial](/microbit/lessons/compass/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What is the purpose of the 'compass heading' block?
Gets the compass heading of the BBC micro:bit in degrees
<br/>
## 2. Write the code that stores the compass heading into a local variable called 'degrees'.
<br/>
```
let degrees = input.compassHeading()
```
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the BBC micro:bit
<br />
```
if (degrees < 45) {
basic.showString("N", 150)
}
```
## 3. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the BBC micro:bit
<br />
```
if (degrees < 135) {
basic.showString("E", 150)
}
```
## 3. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the BBC micro:bit
<br />
```
if (degrees < 225) {
basic.showString("S", 150)
}
```

View File

@ -0,0 +1,32 @@
# compass quiz
Create an actual compass to show your direction: North, South, East, or West
## Name
## Directions
Use this activity document to guide your work in the [compass tutorial](/microbit/lessons/compass/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What is the purpose of the 'compass heading' block?
<br/>
## 2. Write the code that stores the compass heading into a local variable called 'degrees'.
<br/>
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the BBC micro:bit
<br />
## 3. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the BBC micro:bit
<br />
## 3. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the BBC micro:bit
<br />