move lessons out of web site
will move select lessons back to "educators" section
This commit is contained in:
40
olddocs/lessons/magic-logo/activity.md
Normal file
40
olddocs/lessons/magic-logo/activity.md
Normal file
@ -0,0 +1,40 @@
|
||||
# magic logo activity
|
||||
|
||||
Show an image that points up when the logo is up.
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
Welcome! This tutorial will help you display an arrow pointing toward the logo! Let's get started.
|
||||
|
||||
### ~
|
||||
|
||||
Using the **accelerometer** sensor, the micro:bit can detect when the **logo** is oriented **up**. We call that the **logo up** event. We will use `on logo up` to register an event handler that will run when the **logo up** event happens.
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.LogoUp, () => {
|
||||
|
||||
})
|
||||
```
|
||||
|
||||
When the micro:bit goes logo up, the code nested under the `on logo up` function will run. Let's add a line of code to show LEDs in there.
|
||||
|
||||
```blocks
|
||||
input.onGesture(Gesture.LogoUp, () => {
|
||||
basic.showLeds(`
|
||||
. . # . .
|
||||
. # # # .
|
||||
# # # # #
|
||||
. . # . .
|
||||
. . # . .
|
||||
`)
|
||||
})
|
||||
```
|
||||
|
||||
Run your code and try to turn around the micro:bit to see the **logo up** event in action!
|
||||
|
||||
### ~avatar boothing
|
||||
|
||||
Excellent, you're ready to continue with the [challenges](/lessons/magic-logo/challenges)!
|
||||
|
||||
### ~
|
||||
|
58
olddocs/lessons/magic-logo/challenges.md
Normal file
58
olddocs/lessons/magic-logo/challenges.md
Normal file
@ -0,0 +1,58 @@
|
||||
# magic logo challenges
|
||||
|
||||
Coding challenges for magic logo.
|
||||
|
||||
## Before we get started
|
||||
|
||||
Complete the [magic logo](/lessons/magic-logo/activity) activity and your code will look like this:
|
||||
|
||||
```blocks
|
||||
input.onLogoUp(() => {
|
||||
basic.showLeds(`
|
||||
. . # . .
|
||||
. # # # .
|
||||
# # # # #
|
||||
. . # . .
|
||||
. . # . .
|
||||
`)
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Challenge 1
|
||||
|
||||
How about when the logo is down? We should display an arrow pointing downward!
|
||||
|
||||
```blocks
|
||||
input.onLogoUp(() => {
|
||||
basic.showLeds(`
|
||||
. . # . .
|
||||
. # # # .
|
||||
# # # # #
|
||||
. . # . .
|
||||
. . # . .
|
||||
`)
|
||||
})
|
||||
input.onLogoDown(() => {
|
||||
basic.showLeds(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .
|
||||
`)
|
||||
})
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Challenge 2
|
||||
|
||||
Use the `on screen up` event to show a spinning arrow when the screen is turned up.
|
||||
|
||||
### Challenge 3
|
||||
|
||||
Display another animation using the `on screen up` event.
|
||||
|
56
olddocs/lessons/magic-logo/quiz-answers.md
Normal file
56
olddocs/lessons/magic-logo/quiz-answers.md
Normal file
@ -0,0 +1,56 @@
|
||||
# magic logo quiz answers
|
||||
|
||||
show an image that points up when the logo is up.
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
This is the answer key for the [magic logo quiz](/lessons/magic-logo/quiz)
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Define 'on logo up'
|
||||
|
||||
A function that will run code when the BBC micro:bit screen is facing up and vertically orientated.
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Write the condition that detects when the BBC micro:bit logo is facing up and vertically orientated.
|
||||
|
||||
The `logo up` event is raised when...
|
||||
|
||||
* the screen is facing up and the board is horizontal
|
||||
* the screen is facing down and the board is horizontal
|
||||
* the board is vertical and the logo is facing up
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
```blocks
|
||||
input.onLogoUp(() => {
|
||||
})
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Write the code to display a downward pointing arrow when the logo is down.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
```blocks
|
||||
input.onLogoDown(() => {
|
||||
basic.showLeds(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .
|
||||
`)
|
||||
})
|
||||
```
|
||||
|
22
olddocs/lessons/magic-logo/quiz.md
Normal file
22
olddocs/lessons/magic-logo/quiz.md
Normal file
@ -0,0 +1,22 @@
|
||||
# magic logo quiz
|
||||
|
||||
show an image that points up when the logo is up.
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use the hints from the [magic logo activity](/lessons/magic-logo/activity) to answer this quiz!
|
||||
|
||||
## 1. Define what `input->on logo up` does
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Write the condition that detects when the BBC micro:bit logo is facing up and vertically orientated.
|
||||
|
||||
## 3. Write the code to display a downward pointing arrow when the BBC micro:bit logo is down.
|
||||
|
||||

|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user