Migrate docs from the other repo
This commit is contained in:
162
docs/lessons/screen-wipe/challenges.md
Normal file
162
docs/lessons/screen-wipe/challenges.md
Normal file
@ -0,0 +1,162 @@
|
||||
# screen wipe blocks challenges
|
||||
|
||||
Coding challenges for screen wipe.
|
||||
|
||||
## Before we get started
|
||||
|
||||
Complete the [screen wipe](/microbit/lessons/screen-wipe) activity and your code will look like this:
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
`)
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.clearScreen()
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
**Challenge 1**
|
||||
|
||||
Create an event handler for Button B.
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
`)
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.clearScreen()
|
||||
})
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
**Challenge 2**
|
||||
|
||||
### @video td/videos/screen-wipe-2
|
||||
|
||||
Replay the animation when the "B" button is pressed placing the `show LEDs` block on the canvas.
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
`)
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.clearScreen()
|
||||
})
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
`)
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
|
||||
**Challenge 3**
|
||||
|
||||
Show an animation that scrolls back up when you press button "B".
|
||||
|
||||
* tap the *run* button to view your final product!
|
Reference in New Issue
Block a user