move lessons out of web site
will move select lessons back to "educators" section
This commit is contained in:
@ -1,90 +0,0 @@
|
||||
# screen wipe blocks activity
|
||||
|
||||
Clear the screen by pressing buttons on the micro:bit
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
|
||||
|
||||
This activity will teach how to clear the screen by pressing button A on the micro:bit.
|
||||
|
||||
### ~
|
||||
|
||||
You can use the clear screen` function to turn off all the LED on the screen. Let's illustrate this concept with a small script where the user has to press the button A to turn off the screen. Let's start by adding the code to show an animation.
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
`)
|
||||
```
|
||||
|
||||
We add another line of code that registers an *event handler* `on button pressed` *A* and calls `clear screen`.
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
# # # # #
|
||||
# # # # #
|
||||
`)
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.clearScreen()
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
*Run* the script in the simulator or on the micro:bit to see how this works!
|
||||
|
||||
### ~avatar boothing
|
||||
|
||||
Excellent, you're ready to continue with the [challenges](/lessons/screen-wipe/challenges)!
|
||||
|
||||
### ~
|
||||
|
@ -1,162 +0,0 @@
|
||||
# screen wipe blocks challenges
|
||||
|
||||
Coding challenges for screen wipe.
|
||||
|
||||
## Before we get started
|
||||
|
||||
Complete the [screen wipe](/lessons/screen-wipe/activity) 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
|
||||
|
||||
|
||||
|
||||
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!
|
@ -1,42 +0,0 @@
|
||||
# screen wipe quiz blocks answers
|
||||
|
||||
Clear the screen by pressing the "A" button after an animation has been played
|
||||
|
||||
This is the answer key for the [screen wipe quiz](/lessons/screen-wipe/quiz).
|
||||
|
||||
## 1. What does the function "clear screen" do on the micro:bit?
|
||||
|
||||
This function turns off all the LED lights on the LED screen.
|
||||
|
||||
## 2. Write the line of code that displays this image.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . # . .
|
||||
# . . . #
|
||||
. # # # .
|
||||
`)
|
||||
```
|
||||
|
||||
## 3. Write the condition that will detect on button A pressed
|
||||
|
||||
```blocks
|
||||
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
## 4. Write the code that will clear show LEDS from the screen after pressing button A
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.clearScreen()
|
||||
})
|
||||
```
|
||||
|
@ -1,29 +0,0 @@
|
||||
# screen wipe blocks quiz
|
||||
|
||||
Clear the screen by pressing the "A" button after an animation has been played
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [screen wipe activity](/lessons/screen-wipe/activity)
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Describe what "clear screen" does?
|
||||
|
||||
|
||||
|
||||
## 2. Write the code that clears an image from the screen
|
||||
|
||||

|
||||
|
||||
|
||||
## 3. Write the condition that will detect on button A pressed
|
||||
|
||||
|
||||
|
||||
## 4. Write the code that will clear show LEDS from the screen after pressing button A
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user