fixing various doc links
This commit is contained in:
@ -7,7 +7,7 @@ Measure the acceleration on the micro:bit in the "x" direction.
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [glowing pendulum activity](/lessons/charting/acceleration)
|
||||
Use this activity document to guide your work in the [charting activity](/lessons/charting)
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
|
@ -49,5 +49,3 @@ input.onButtonPressed(Button.B, () => {
|
||||
### Challenge 3
|
||||
|
||||
Add an event handler with `on shake` to change the LED brightness back to a `255`.
|
||||
|
||||
* `Run main` your script to see the LEDs change brightness.
|
||||
|
@ -1,94 +0,0 @@
|
||||
# offset image challenges
|
||||
|
||||
Coding challenges for the offset image tutorial.
|
||||
|
||||
## Before we get started
|
||||
|
||||
Complete the following exercise. Your code should look like this:
|
||||
|
||||
```blocks
|
||||
offset = 0
|
||||
basic.forever(() => {
|
||||
if (offset == -4) {
|
||||
basic.showString("Push button A", 150)
|
||||
}
|
||||
images.createImage(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .
|
||||
`).showImage(offset)
|
||||
})
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
offset = offset + 1
|
||||
})
|
||||
```
|
||||
|
||||
### Challenge 1
|
||||
|
||||
Create a condition for if button `B` is pressed. We want the image to move to the left when button `B` is pressed.
|
||||
|
||||
```
|
||||
offset = 0
|
||||
basic.forever(() => {
|
||||
if (offset == -4) {
|
||||
basic.showString("Push button A", 150)
|
||||
}
|
||||
images.createImage(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .
|
||||
`).showImage(offset)
|
||||
})
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
offset = offset + 1
|
||||
})
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
offset = offset - 1 // ***
|
||||
}) // ***
|
||||
```
|
||||
|
||||
* Run the code to see if it works as expected.
|
||||
|
||||
### Challenge 2
|
||||
|
||||
|
||||
|
||||
Now we want to make sure that the button does not go off the screen to the right. Add a new line that checks to see if offset = 5 after button `A` is pressed.
|
||||
|
||||
If `offset = 5` then prompt the user to move the image to the left by displaying the text: "Push button B".
|
||||
|
||||
```
|
||||
offset = 0
|
||||
basic.forever(() => {
|
||||
if (offset == -4) {
|
||||
basic.showString("Push button A", 150)
|
||||
}
|
||||
if (offset == 5) {
|
||||
basic.showString("Press Button B", 150) // ***
|
||||
}
|
||||
images.createImage(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .
|
||||
`).showImage(offset)
|
||||
})
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
offset = offset + 1
|
||||
})
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
offset = offset - 1
|
||||
})
|
||||
```
|
||||
|
||||
* Run the code to see if it works as expected.
|
||||
|
||||
### Challenge 3
|
||||
|
||||
Now make sure the image does not go off the left side and if it does, prompt the user to push button `A`.
|
||||
|
@ -1,48 +0,0 @@
|
||||
# offset image quiz answers
|
||||
|
||||
shift an image horizontally across the display with offset.
|
||||
|
||||
This is the answer key for the [offset image quiz](/lessons/offset-image/quiz).
|
||||
|
||||
## 1. What is a 'if, then, else statement' ?
|
||||
|
||||
<br/>
|
||||
|
||||
An if-then statement will run a block of code if the condition specified is true. The statement will run the "else" block of code if that condition is false.
|
||||
|
||||
## 2. Consider the message
|
||||
|
||||
Write the line of code that that will create the message "Push button A" (Hint: This message appears `if` the offset is equal -4 then the BBC micro:bit will state "Push Button A").
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
if (offset == -4) {
|
||||
basic.showString("Push Button A", 150)
|
||||
}
|
||||
```
|
||||
|
||||
## 3. Consider the following image
|
||||
|
||||

|
||||
|
||||
When with this image be displayed?
|
||||
|
||||
<br/>
|
||||
|
||||
When the offset is NOT equal to -4 then the BBC micro:bit will show the image above.
|
||||
|
||||
## 4. Consider the following image
|
||||
|
||||

|
||||
|
||||
Write the two lines of code that cause the `variable` offset to increase by one when button `A` is pressed.
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
offset = offset + 1
|
||||
})
|
||||
```
|
||||
|
@ -1,36 +0,0 @@
|
||||
# offset image quiz
|
||||
|
||||
shift an image horizontally across the display with offset.
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [offset image activity](/lessons/offset-image/activity).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. What is an 'if, then, else statement' ?
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Write the line condition that if true, will display the message "Push button A". This message appears if the offset is equal -4 then the BBC micro:bit will state "Push Button A".
|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. Write the one line of code to show this image
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
<br/>
|
||||
|
||||
## 4. Write the two lines of code that trigger the variable offset to increase by one.
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
@ -106,7 +106,7 @@ Science: Welcome! The activity will teach you how to chart the acceleration of t
|
||||
## 6.
|
||||
First, notice that moving the 1st micro:bit in the simulator in any direction, you will change the acceleration value of the 2nd micro:bit. Also, notice that by moving the micro:bit simulator, there is a changing acceleration value of the second micro:bit. Second, the flat colored horizontal line will start a waving line on the 2nd micro:bit to display the value of the strength as measured in milli-gravities. Finally, notice that the LED display will fluctate based on the movement of the 2nd micro:bit simulator.
|
||||
|
||||

|
||||

|
||||
|
||||
## 7.
|
||||
|
||||
|
Reference in New Issue
Block a user