51 lines
959 B
Markdown
51 lines
959 B
Markdown
# strobe light quiz
|
|
|
|
Learn how to create a blinking LED script with a for loop. #LED #screen #plot #docs
|
|
|
|
## Name
|
|
|
|
## Directions
|
|
|
|
Use this activity document to guide your work in the [strobe light tutorial](/microbit/lessons/strobe-light/tutorial)
|
|
|
|
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
|
|
|
## 1. What is a for loop?
|
|
|
|
## 2. Draw which LEDs are ON after running this code
|
|
|
|
```
|
|
for (let i = 0; i < 5; i++) {
|
|
for (let j = 0; j < 5; j++) {
|
|
led.plot(i, j)
|
|
}
|
|
}
|
|
```
|
|
|
|
![](/static/mb/empty-microbit.png)
|
|
|
|
## 3. Draw which LEDs are ON after running this code
|
|
|
|
```
|
|
for (let i1 = 0; i1 < 3; i1++) {
|
|
for (let j1 = 0; j1 < 3; j1++) {
|
|
led.plot(i1, j1)
|
|
}
|
|
}
|
|
```
|
|
|
|
![](/static/mb/empty-microbit.png)
|
|
|
|
## 4. Draw which LEDs are ON after running this code
|
|
|
|
```
|
|
for (let i2 = 0; i2 < 2; i2++) {
|
|
for (let j2 = 0; j2 < 2; j2++) {
|
|
led.plot(i2, j2)
|
|
}
|
|
}
|
|
```
|
|
|
|
![](/static/mb/empty-microbit.png)
|
|
|