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,37 @@
# smiley blocks activity
Learn to design a blinking image.
### ~avatar avatar
### @video td/videos/smiley-0
Welcome! This tutorial will help you make a smiley face blink. Let's get started!
### ~
Create an animation with an image displaying a smiley face and the next image with no LEDs lit up. This will make it look like the smiley face is blinking as the display switches between images.
```blocks
basic.showAnimation(`
. # . # .
. # . # .
. . . . .
# . . . #
. # # # .
`)
basic.showAnimation(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
```
### ~avatar boothing
Excellent, you're ready to continue with the [challenges](/microbit/lessons/smiley/challenges)!
### ~

View File

@ -0,0 +1,93 @@
# smiley blocks challenges
Coding challenges for the smiley.
## Before we get started
Complete the [smiley activity](/microbit/lessons/smiley/activity) and your code will look like this:
```blocks
basic.showAnimation(`
. # . # .
. # . # .
. . . . .
# . . . #
. # # # .
`)
basic.showAnimation(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
```
### Challenge 1
What if we want to make the face to frown on button pressed A?
Let's make add code that will run when button A is pressed!
```blocks
basic.showAnimation(`
. # . # .
. # . # .
. . . . .
# . . . #
. # # # .
`)
basic.showAnimation(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
input.onButtonPressed(Button.A, () => {
})
```
### Challenge 2
### @video td/videos/smiley-2
Now, we want to show a frowny face when this button is pressed. Let's show the LEDs.
```blocks
basic.showAnimation(`
. # . # .
. # . # .
. . . . .
# . . . #
. # # # .
`)
basic.showAnimation(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
input.onButtonPressed(Button.A, () => {
basic.showAnimation(`
. # . # .
. # . # .
. . . . .
. # # # .
# . . . #
`)
})
```
* Run your code to see if it works as expected.
### Challenge 3
When *button B* is pressed, let's change the sad face back to a happy face. To do this, begin by adding a condition for `on button pressed` *B*. Next, show LEDs as a smiley face inside the condition.

View File

@ -0,0 +1,28 @@
# smiley blocks quiz answers
This is the answer key for the [smiley quiz](/microbit/lessons/smiley/quiz).
## 1. Describe what `show LEDs` does
A function that will display an image on the LED screen
## 2. Why is there an extra empty frame after the smiley face?
![](/static/mb/lessons/smiley-0.png)
<br/>
The extra empty image with show LED creates a blinking smiley, allowing the micro:bit to alternate between showing the smiley and the empty screen.
## 3. Draw the image created with this code
![](/static/mb/blocks/lessons/smiley-3.png)
![](/static/mb/blocks/lessons/smiley-4.png)
## 4. Write the code to make this image
![](/static/mb/blocks/lessons/smiley-5.png)
![](/static/mb/blocks/lessons/smiley-6.png)

View File

@ -0,0 +1,36 @@
# smiley blocks quiz
Make a smiley face blink
## Name
## Directions
Use the hints in the [Smiley](/microbit/lessons/smiley/activity) activity to answer this quiz!
## 1. Describe what `show LEDs` does
<br/>
<br/>
## 2. Why is there an extra empty frame after the smiley face?
![](/static/mb/lessons/smiley-0.png)
<br/>
## 3. Draw the image created with this code
![](/static/mb/blocks/lessons/smiley-3.png)
![](/static/mb/empty-microbit.png)
<br/>
## 4. Draw the images created with this code
![](/static/mb/blocks/lessons/smiley-5.png)
![](/static/mb/lessons/looper-3.png)