pxt-calliope/olddocs/lessons/counter/quiz.md

55 lines
1.0 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# counter quiz
Learn how to create a counter with the BBC micro:bit button.
## Name
## Directions
2016-04-13 17:27:45 +02:00
Use this activity document to guide your work in the [counter tutorial](/lessons/counter/activity).
2016-03-26 00:47:20 +01:00
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What is a variable?
<br/>
## 2. Draw the stored value for the variable called count
2016-03-30 01:17:34 +02:00
```blocks
2016-03-26 00:47:20 +01:00
let count = 0
```
![](/static/mb/empty-microbit.png)
<br/>
## 3. Draw which LEDs are ON after running this code and pressing button "A" once. Explain you chose to draw that number
2016-03-30 01:17:34 +02:00
```blocks
2016-03-31 00:11:05 +02:00
let counts = 0
input.onButtonPressed(Button.A, () => {
2016-03-31 00:11:05 +02:00
counts = counts + 1
basic.showNumber(counts, 150)
2016-03-26 00:47:20 +01:00
})
```
![](/static/mb/empty-microbit.png)
<br/>
## 4. Draw which LEDs are ON after running this code and pressing button "A" three times. Explain you chose to draw that number
2016-03-30 01:17:34 +02:00
```blocks
2016-03-31 00:11:05 +02:00
let counting= 0
input.onButtonPressed(Button.A, () => {
2016-03-31 00:11:05 +02:00
counting = counting + 1
basic.showNumber(counting, 100)
2016-03-26 00:47:20 +01:00
})
```
![](/static/mb/empty-microbit.png)
<br/>