file management quizzes
This commit is contained in:
@ -1,54 +0,0 @@
|
||||
# counter quiz answers
|
||||
|
||||
Learn how to create a counter with the BBC micro:bit button.
|
||||
|
||||
This is the answer key for the [counter quiz](/microbit/lessons/counter/quiz).
|
||||
|
||||
## 1. What is a variable?
|
||||
|
||||
Answers may vary but a variable is a place where you can store and retrieve data
|
||||
|
||||
## 2. Draw the stored value for the variable called count
|
||||
|
||||
```
|
||||
let count = 0
|
||||
```
|
||||
|
||||

|
||||
|
||||
We create a **variable**, `count` to keep track of the current count. The number 0 is stored into memory of the variable.
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Draw which LEDs are ON after running this code and pressing button "A" once. Explain you chose to draw that number
|
||||
|
||||
```
|
||||
let count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count, 150)
|
||||
})
|
||||
```
|
||||
|
||||

|
||||
|
||||
We are only pressing on button pressed once. So the number to display on the micro:bit is also one.
|
||||
|
||||
<br/>
|
||||
|
||||
## 4. Draw which LEDs are ON after running this code and pressing button "A" three times. Explain you chose to draw that number
|
||||
|
||||
```
|
||||
count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count_, 100)
|
||||
})
|
||||
```
|
||||
|
||||

|
||||
|
||||
We included the code ``on button pressed("A")`` that runs each time the user presses A. The code increments `count` by `1`. We increase `count` by 1 whenever the user presses the button. So the third time the A button is pressed on the BBC micro:bit, the number 3 is displayed
|
||||
|
||||
<br/>
|
||||
|
@ -1,54 +0,0 @@
|
||||
# counter quiz
|
||||
|
||||
Learn how to create a counter with the BBC micro:bit button.
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [counter tutorial](/microbit/lessons/counter/activity).
|
||||
|
||||
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
|
||||
|
||||
```
|
||||
let count = 0
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Draw which LEDs are ON after running this code and pressing button "A" once. Explain you chose to draw that number
|
||||
|
||||
```
|
||||
let count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count_, 100)
|
||||
})
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 4. Draw which LEDs are ON after running this code and pressing button "A" three times. Explain you chose to draw that number
|
||||
|
||||
```
|
||||
count_ = 0
|
||||
input.onButtonPressed("A", () => {
|
||||
count_ = count_ + 1
|
||||
basic.showNumber(count_, 100)
|
||||
})
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
@ -1,42 +0,0 @@
|
||||
# die roll quiz
|
||||
|
||||
Create a die when the BBC micro:bit is shaken
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [die roll tutorial](/microbit/lessons/die-roll/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Create a variable named 'roll' that will be randomly assigned to a number between 0 and 5.
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. If the variable "roll" equals 5, write the code that will plot the image below
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 3. You will use an `else if` condition if "roll" is equal 4. Write the `else if` statement that will display the plot image below
|
||||
|
||||

|
||||
|
||||
<br />
|
||||
|
||||
<br/>
|
||||
|
||||
## 4. You will use an `else if` condition if "roll" is equal 3. Write the `else if` statement that will display the plot image below
|
||||
|
||||

|
||||
|
||||
<br />
|
||||
|
||||
## 5. You will use an `else if` condition if "roll" is equal 2. Write the `else if` that will display the image below
|
||||
|
||||

|
||||
|
||||
<br />
|
||||
|
@ -1,39 +0,0 @@
|
||||
# guess the number quiz answers
|
||||
|
||||
Learn how to generate a random number on the micro:bit. #math #random #docs
|
||||
|
||||
This is the answer key for the [guess the number quiz](/microbit/lessons/guess-the-number/quiz).
|
||||
|
||||
## 1. What is on button pressed?
|
||||
|
||||
Answers may vary. Generally, on button pressed run code when an input button is pressed. The micro:bit has two input buttons: A and B.
|
||||
|
||||
## 2. Consider the following directions
|
||||
|
||||
Write the line of code that creates a condition when the BBC micro:bit button A is pressed.
|
||||
|
||||
```
|
||||
input.onButtonPressed("A", () => {
|
||||
})
|
||||
```
|
||||
|
||||
## 3. Consider the following directions
|
||||
|
||||
Write the line of code that creates a **local variable** and a **random number**.
|
||||
|
||||
```
|
||||
let randomNumber = Math.random(10)
|
||||
```
|
||||
|
||||
## 4. Consider the following code
|
||||
|
||||
```
|
||||
randomNumber = Math.random(10)
|
||||
```
|
||||
|
||||
If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
|
||||
|
||||

|
||||
|
||||
The random number generator will return a number from 0 to the limit. However, not including the limit unless the limit is 0. So you can place an X to represent any single digit number.
|
||||
|
@ -1,35 +0,0 @@
|
||||
# guess the number quiz
|
||||
|
||||
Learn how to generate a random number on the micro:bit. #math #random #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [guess the number tutorial](/microbit/lessons/guess-the-number/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Describe what "input -> on button pressed" does?
|
||||
|
||||
<br />
|
||||
|
||||
## 2. Write the line of code that creates a condition for on button A pressed.
|
||||
|
||||
<br />
|
||||
|
||||
## 3. Write the line of code that creates a `local variable` called `randomNumber` and will return a number from 0 to a limit of 10.
|
||||
|
||||
<br />
|
||||
|
||||
## 4. Draw the area that could be lit based on the code below. Explain why you chose to draw that number.
|
||||
|
||||
```
|
||||
let randomNumber = Math.random(10)
|
||||
basic.showNumber(randomNumber, 150)
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br />
|
||||
|
@ -1,40 +0,0 @@
|
||||
# looper quiz answers
|
||||
|
||||
Learn how to create a series of numbers with a for loop. #LED #screen #plot #docs
|
||||
|
||||
This is the answer key for the [looper quiz](/microbit/lessons/looper/quiz).
|
||||
|
||||
## 1. What is a for loop?
|
||||
|
||||
Answers will vary. In general, for loop refers to the code that repeats for a fixed number of times. We specify the LED using x, y coordinates.
|
||||
|
||||
## 2. Consider the following code
|
||||
|
||||
```
|
||||
for (let i = 0; i < 4; i++) {
|
||||
basic.showNumber(i, 150)
|
||||
}
|
||||
```
|
||||
|
||||
If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
|
||||
|
||||
Let's create a for loop where `0` is the loop's starting value, `i` is the index variable, and `4` is the ending value. The index variable `i` starts at 0 and increases by 1 each time through the loop. The loop ends when `i = 4`.
|
||||
|
||||

|
||||
|
||||
## 3. Consider the following code
|
||||
|
||||
```
|
||||
for (let i1 = 0; i1 < 6; i1++) {
|
||||
basic.showNumber(i1, 150)
|
||||
}
|
||||
```
|
||||
|
||||
If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
|
||||
|
||||
Let's create a for loop where `0` is the loop's starting value, `i` is the index variable, and `6` is the ending value. The index variable `i` starts at 0 and increases by 1 each time through the loop. The loop ends when `i = 6`.
|
||||
|
||||

|
||||
|
||||

|
||||
|
@ -1,42 +0,0 @@
|
||||
# looper quiz
|
||||
|
||||
Learn how to create a series of numbers with a for loop. #LED #screen #plot #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [looper tutorial](/microbit/lessons/looper/tutorial)
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Describe what a "for loop" does?
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Draw the areas where the LEDs will be lit based on the code below. Explain why you chose to draw those numbers.
|
||||
|
||||
```
|
||||
for (let i = 0; i < 4; i++) {
|
||||
basic.showNumber(i, 150)
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Draw the areas where the LEDs will be lit based on the code below. Explain why you chose to draw those numbers.
|
||||
|
||||
```
|
||||
for (let i1 = 0; i1 < 6; i1++) {
|
||||
basic.showNumber(i1, 150)
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
@ -1,57 +0,0 @@
|
||||
# magic 8 quiz answers
|
||||
|
||||
create a magic 8 ball on the BBC micro:bit #math #random #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [magic 8 tutorial](/microbit/lessons/magic-8/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Define what an 'if statement' is.
|
||||
|
||||
<br />
|
||||
|
||||
An if statement will conditionally run code depending on whether or not a condition is true.
|
||||
|
||||
## 2. Create a Variable called ``x`` and assign it to a random number between 0 and 2.
|
||||
|
||||
```
|
||||
let x = Math.random(3)
|
||||
```
|
||||
|
||||
## 3. Write the 'if statement' to check if ``x`` is equal to 2. Inside the 'if statement', display the string "Yes".
|
||||
|
||||
```
|
||||
if (x == 2) {
|
||||
basic.showString("Yes", 150)
|
||||
}
|
||||
```
|
||||
|
||||
## 3. Write the 'if statement' to check if ``x`` is equal to 1. Inside the 'if statement', display the string "No."
|
||||
|
||||
```
|
||||
if (x == 2) {
|
||||
basic.showString("Yes", 150)
|
||||
} else if (x == 1) {
|
||||
basic.showString("No", 150)
|
||||
}
|
||||
```
|
||||
|
||||
## 5. Write the code to display the string "I don't know" if the Variable ``x`` is neither 2 nor 1.
|
||||
|
||||
```
|
||||
if (x == 2) {
|
||||
basic.showString("Yes", 150)
|
||||
} else if (x == 1) {
|
||||
basic.showString("No", 150)
|
||||
}
|
||||
else {
|
||||
basic.showString("I don't know", 150)
|
||||
}
|
||||
```
|
||||
|
||||
Note: Students are only required to write the bottom half of this answer (starting with "else").
|
||||
|
@ -1,32 +0,0 @@
|
||||
# magic 8 quiz
|
||||
|
||||
create a magic 8 ball on the BBC micro:bit #math #random #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [magic 8 tutorial](/microbit/lessons/magic-8/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Define what an 'if statement' is.
|
||||
|
||||
<br />
|
||||
|
||||
## 2. Create a Variable called ``x`` and assign it to a random number between 0 and 2.
|
||||
|
||||
<br />
|
||||
|
||||
## 3. Write the 'if statement' to check if ``x`` is equal to 2. Inside the 'if statement', display the string "Yes".
|
||||
|
||||
<br />
|
||||
|
||||
## 3. Write the 'if statement' to check if ``x`` is equal to 1. Inside the 'if statement', display the string "No."
|
||||
|
||||
<br />
|
||||
|
||||
## 5. Write the code to display the string "I don't know" if the Variable ``x`` is neither 2 nor 1.
|
||||
|
||||
<br />
|
||||
|
@ -1,51 +0,0 @@
|
||||
# magic logo quiz answers
|
||||
|
||||
show an image that points up when the logo is up #logo #show #create #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
This is the answer key for the [magic logo quiz](/microbit/lessons/magic-logo/quiz)
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Define 'on logo up'
|
||||
|
||||
A function that will run code when the BBC micro:bit screen is facing up and vertically orientated.
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Consider the following directions
|
||||
|
||||
Write the condition that detects when the BBC micro:bit logo is facing up and vertically orientated.
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
input.onLogoUp(() => {
|
||||
})
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Consider the following animation
|
||||
|
||||

|
||||
|
||||
Write the code to display a downward pointing arrow when the logo is down.
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
input.onLogoDown(() => {
|
||||
basic.plotImage(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .
|
||||
`)
|
||||
})
|
||||
```
|
||||
|
@ -1,26 +0,0 @@
|
||||
# magic logo quiz
|
||||
|
||||
show an image that points up when the logo is up #logo #show #create #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use the hints from the [magic logo activity](/microbit/lessons/magic-logo/activity) to answer this quiz!
|
||||
|
||||
## 1. Define what `input->on logo up` does
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. The `logo up` event is raised when...
|
||||
|
||||
* the screen is facing up and the board is horizontal
|
||||
* the screen is facing down and the board is horizontal
|
||||
* the board is vertical and the logo is facing up
|
||||
|
||||
## 3. Consider the following animation
|
||||
|
||||

|
||||
|
||||
Write the code to display a downward pointing arrow when the BBC micro:bit logo is down.
|
||||
|
@ -1,46 +0,0 @@
|
||||
# night light quiz answers
|
||||
|
||||
Answers to the night light quiz. #LED #image #brightness #fade #docs
|
||||
|
||||
This is the answer key for the [night light quiz](/microbit/lessons/night-light/quiz).
|
||||
|
||||
## 1. Define the function "set brightness"
|
||||
|
||||
This function sets the brightness of the LED screen.
|
||||
|
||||
## 2. Consider the following image
|
||||
|
||||

|
||||
|
||||
If the rectangle above represents the BBC micro:bit, write the code to set all the LEDs to full brightness and to turn on all the LEDs.
|
||||
|
||||
<br />
|
||||
|
||||
```
|
||||
led.setBrightness(255)
|
||||
led.plotAll()
|
||||
```
|
||||
|
||||
## 3. Consider the following image
|
||||
|
||||

|
||||
|
||||
If the rectangle above represents the BBC micro:bit, write the code to set the screen brightness to 50% (128) and turns on all the LEDs.
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
led.setBrightness(128)
|
||||
led.plotAll()
|
||||
```
|
||||
|
||||
## 4. Consider the following image
|
||||
|
||||

|
||||
|
||||
If the rectangle above represents the BBC micro:bit, write the code to turn off all the LEDs.
|
||||
|
||||
```
|
||||
led.setBrightness(0)
|
||||
```
|
||||
|
@ -1,30 +0,0 @@
|
||||
# night light quiz
|
||||
|
||||
change the brightness of the BBC micro:bit #LED #image #brightness #fade #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [night light tutorial](/microbit/lessons/night-light/tutorial)
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Describe what "led->set brightness" does ?
|
||||
|
||||
## 2. If the picture below is the BBC micro:bit, write the code that sets all the LEDs to full brightness and turns on all the LEDs
|
||||
|
||||

|
||||
|
||||
<br />
|
||||
|
||||
## 3. If the picture below is the BBC micro:bit, write the code that sets the screen brightness to 50% (128) and turns on all the LEDs.
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 4. If the picture below is the BBC micro:bit, write the code turns off all the LEDs.
|
||||
|
||||

|
||||
|
@ -1,74 +0,0 @@
|
||||
# rock paper scissors quiz
|
||||
|
||||
shift an image horizontally across the display with offset #offset #screen #variables #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [rock paper scissors tutorial](/microbit/lessons/rock-paper-scissors/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Describe what `offset` does?
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Draw which LEDs are ON after running this code and the random number returned is 0
|
||||
|
||||
```
|
||||
let img = images.createImage(`
|
||||
. . . . . # # # # # . . . . #
|
||||
. # # # . # . . . # # # . # .
|
||||
. # # # . # . . . # . # # . .
|
||||
. # # # . # . . . # # # . # .
|
||||
. . . . . # # # # # . . . . #
|
||||
`)
|
||||
let offset = Math.random(3) * 5
|
||||
img.showImage(offset)
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Draw which LEDs are ON after running this code with an offset of 5. This would occur if the random number returned is 1.
|
||||
|
||||
```
|
||||
let img_ = images.createImage(`
|
||||
. . . . . # # # # # . . . . #
|
||||
. # # # . # . . . # # # . # .
|
||||
. # # # . # . . . # . # # . .
|
||||
. # # # . # . . . # # # . # .
|
||||
. . . . . # # # # # . . . . #
|
||||
`)
|
||||
let offset_ = Math.random(3) * 5
|
||||
img.showImage(offset)
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
## 4. Draw which LEDs are ON after running this code with an offset of 10. This would occur if the random number returned is 2.
|
||||
|
||||
```
|
||||
let img_1 = images.createImage(`
|
||||
. . . . . # # # # # . . . . #
|
||||
. # # # . # . . . # # # . # .
|
||||
. # # # . # . . . # . # # . .
|
||||
. # # # . # . . . # # # . # .
|
||||
. . . . . # # # # # . . . . #
|
||||
`)
|
||||
let offset_1 = Math.random(3) * 5
|
||||
img.showImage(offset)
|
||||
```
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
@ -1,56 +0,0 @@
|
||||
# spinner quiz answers
|
||||
|
||||
a spin the BBC micro:bit game with the input on shake #math #random #docs #shake
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [spinner tutorial](/microbit/lessons/spinner/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Write the code that stores a random number between 0 and 3 into a local variable named 'random arrow'.
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
let randomArrow = Math.random(4)
|
||||
```
|
||||
|
||||
## 2. Write the if statement that will display this down arrow from your code. Hint- This occurs if the local variable 'random arrow' returns 1.
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
if (randomArrow == 1) {
|
||||
basic.plotImage(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .
|
||||
`)
|
||||
}
|
||||
```
|
||||
|
||||
## 3. Write the if statement that will display this right arrow. Hint- This occurs if the local variable 'random arrow' returns 2.
|
||||
|
||||

|
||||
|
||||
<br />
|
||||
|
||||
```
|
||||
if (randomArrow == 2) {
|
||||
basic.plotImage(`
|
||||
. . # . .
|
||||
. . # # .
|
||||
# # # # #
|
||||
. . # # .
|
||||
. . # . .
|
||||
`)
|
||||
}
|
||||
```
|
||||
|
@ -1,28 +0,0 @@
|
||||
# spinner quiz
|
||||
|
||||
a spin the BBC micro:bit game with the input on shake #math #random #docs #shake
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [spinner tutorial](/microbit/lessons/spinner/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Write the code that stores a random number between 0 and 3 into a local variable named 'random arrow'.
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Write the if statement that will display this down arrow from your code. Hint- This occurs if the local variable 'random arrow' returns 1.
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Write the if statement that will display this right arrow. Hint- This occurs if the local variable 'random arrow' returns 2.
|
||||
|
||||

|
||||
|
||||
<br />
|
||||
|
@ -1,70 +0,0 @@
|
||||
# strobe light quiz answers
|
||||
|
||||
Learn how to create a blinking images with a for loop. #LED #screen #plot #docs
|
||||
|
||||
This is the answer key for the [strobe light quiz](/microbit/lessons/strobe-light/quiz).
|
||||
|
||||
## 1. What is a for loop?
|
||||
|
||||
Answers will vary. In general, for loop refers to the code that repeats for a fixed number of times. We specify the LED using x, y coordinates.
|
||||
|
||||
## 2. Consider the following code
|
||||
|
||||
```
|
||||
for (let i = 0; i < 5; i++) {
|
||||
for (let j = 0; j < 5; j++) {
|
||||
led.plot(i, j)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If the rectangle below represents a board that is 5 LEDs wide and 5 LEDs tall, place an X approximately where the LED is lighted. Explain why the LED is lighted there.
|
||||
|
||||

|
||||
|
||||
This code turns on specific LED. Plot turns on the specified LED on the LED screen. We specify the LED using x, y coordinates. The code lights on the LEDs
|
||||
|
||||
``x`` - the x coordinate or horizontal position (0,1,2,3,4)
|
||||
|
||||
``y`` - the y coordinate or vertical position (0,1,2,3,4)
|
||||
|
||||
## 3. Consider the following code
|
||||
|
||||
```
|
||||
for (let i1 = 0; i1 < 3; i1++) {
|
||||
for (let j1 = 0; j1 < 3; j1++) {
|
||||
led.plot(i1, j1)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If the rectangle below represents a board that is 5 LEDs wide and 5 LEDs tall, place an X approximately where the LED is lighted. Explain why the LED is lighted there.
|
||||
|
||||

|
||||
|
||||
This code turns on specific LED. Plot turns on the specified LED on the LED screen. We specify the LED using x, y coordinates.
|
||||
|
||||
``x`` - the x coordinate or horizontal position (0,1,2)
|
||||
|
||||
``y`` - the y coordinate or vertical position (0,1,2)
|
||||
|
||||
## 4. Consider the following code
|
||||
|
||||
```
|
||||
for (let i2 = 0; i2 < 2; i2++) {
|
||||
for (let j2 = 0; j2 < 2; j2++) {
|
||||
led.plot(i2, j2)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If the rectangle below represents a board that is 5 LEDs wide and 5 LEDs tall, place an X approximately where the LED is lighted. Explain why the LED is lighted there.
|
||||
|
||||

|
||||
|
||||
This code turns on specific LED. Plot turns on the specified LED on the LED screen. We specify the LED using x, y coordinates.
|
||||
|
||||
``x`` - the x coordinate or horizontal position (0,1)
|
||||
|
||||
``y`` - the y coordinate or vertical position (0,1)
|
||||
|
@ -1,50 +0,0 @@
|
||||
# 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)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||
## 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)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||
## 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)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
@ -1,38 +0,0 @@
|
||||
# truth or dare quiz answers
|
||||
|
||||
a multi-player game that forces each player to reveal a secret or something funny #math #random #docs #shake
|
||||
|
||||
This is the answer key for the [truth or dare quiz](/microbit/lessons/truth-or-dare/quiz).
|
||||
|
||||
## 1. Write the code that will randomly return 0 through 3 and stores the value inside a local variable called 'random'.
|
||||
|
||||
```
|
||||
let random = Math.random(4)
|
||||
```
|
||||
|
||||
## 2. Write an if statement that will display the message "TRUTH" on the BBC micro:bit if the local variable 'random' equals 0.
|
||||
|
||||
```
|
||||
if (random == 0) {
|
||||
basic.showString("TRUTH", 150)
|
||||
}
|
||||
```
|
||||
|
||||
## 3. If the local variable 'random' equals 1, write the string that will be displayed.
|
||||
|
||||
DARE
|
||||
|
||||
## 4.Write the code that will display this up arrow after pressing button "A".
|
||||
|
||||

|
||||
|
||||
```
|
||||
basic.plotImage(`
|
||||
. . # . .
|
||||
. # # # .
|
||||
# # # # #
|
||||
. . # . .
|
||||
. . # . .
|
||||
`)
|
||||
```
|
||||
|
@ -1,36 +0,0 @@
|
||||
# truth or dare quiz
|
||||
|
||||
a multi-player game that forces each player to reveal a secret or something funny #math #random #docs #shake
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [truth or dare tutorial](/microbit/lessons/truth-or-dare/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Write the code that will randomly return 0 through 3 and stores the value inside a local variable called 'random'.
|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Write an if statement that will display the message "TRUTH" on the BBC micro:bit if the local variable 'random' equals 0.
|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. If the local variable 'random' equals 1, write the string that will be displayed.
|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
## 4.Write the code that will display this up arrow after pressing button "A".
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
Reference in New Issue
Block a user