fixing various doc links
This commit is contained in:
parent
d7528c09e3
commit
cd0b2a646f
@ -7,7 +7,7 @@ Measure the acceleration on the micro:bit in the "x" direction.
|
|||||||
|
|
||||||
## Directions
|
## 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!
|
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||||
|
|
||||||
|
@ -49,5 +49,3 @@ input.onButtonPressed(Button.B, () => {
|
|||||||
### Challenge 3
|
### Challenge 3
|
||||||
|
|
||||||
Add an event handler with `on shake` to change the LED brightness back to a `255`.
|
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
|
|
||||||
|
|
||||||
![](/static/mb/lessons/offset-image-0.png)
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
![](/static/mb/lessons/offset-image-1.png)
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
![](/static/mb/lessons/offset-image-0.png)
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 4. Write the two lines of code that trigger the variable offset to increase by one.
|
|
||||||
|
|
||||||
![](/static/mb/lessons/offset-image-1.png)
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
@ -106,7 +106,7 @@ Science: Welcome! The activity will teach you how to chart the acceleration of t
|
|||||||
## 6.
|
## 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.
|
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.
|
||||||
|
|
||||||
![](/static/mb//lessons/seis_challenge02.png)
|
![](/static/mb/lessons/seis_challenge02.png)
|
||||||
|
|
||||||
## 7.
|
## 7.
|
||||||
|
|
||||||
|
@ -30,5 +30,4 @@ devices.onSignalStrengthChanged(() => {
|
|||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
|
||||||
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [on notified](/reference/devices/on-notified), [signal strength](/reference/devices/signal-strength)
|
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength)
|
||||||
|
|
@ -59,5 +59,5 @@ devices.raiseAlertTo("ring alarm")
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[tell remote control to](/reference/devices/tell-remote-control-to), [tell camera to](/reference/devices/tell-camera-to), [on notified](/reference/devices/on-notified)
|
[tell remote control to](/reference/devices/tell-remote-control-to), [tell camera to](/reference/devices/tell-camera-to)
|
||||||
|
|
||||||
|
@ -30,5 +30,5 @@ devices.onSignalStrengthChanged(() => {
|
|||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
|
||||||
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [on notified](/reference/devices/on-notified), [on signal strength changed](/reference/devices/on-signal-strength-changed)
|
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [on signal strength changed](/reference/devices/on-signal-strength-changed)
|
||||||
|
|
||||||
|
@ -76,5 +76,5 @@ devices.tellCameraTo("stop video mode")
|
|||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
|
||||||
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [on notified](/reference/devices/on-notified)
|
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to)
|
||||||
|
|
||||||
|
@ -45,14 +45,3 @@ To tell the connected device to stop recording audio
|
|||||||
```
|
```
|
||||||
devices.tellMicrophoneTo("stop capture")
|
devices.tellMicrophoneTo("stop capture")
|
||||||
```
|
```
|
||||||
|
|
||||||
### Other show functions
|
|
||||||
|
|
||||||
* use [tell remote control to](/reference/devices/tell-remote-control-to) to control presentation of media content
|
|
||||||
* use [tell camera to](/reference/devices/tell-camera-to) to control the photo/video recording of connected devices
|
|
||||||
* use [raise alert to](/reference/devices/raise-alert-to) to control the microphone of connected devices
|
|
||||||
|
|
||||||
### See also
|
|
||||||
|
|
||||||
[Devices](/reference/devices)
|
|
||||||
|
|
||||||
|
@ -88,5 +88,5 @@ devices.tellRemoteControlTo("volume down")
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[tell camera to](/reference/devices/tell-camera-to), [raise alert to](/reference/devices/raise-alert-to), [on notified](/reference/devices/on-notified)
|
[tell camera to](/reference/devices/tell-camera-to), [raise alert to](/reference/devices/raise-alert-to)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ input.onButtonPressed(Button.B, () => {
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[Getting Started](/reference/getting-started), [image](/reference/images/image),
|
[Getting Started](/getting-started), [image](/reference/images/image),
|
||||||
[create image](/reference/images/create-image),
|
[create image](/reference/images/create-image),
|
||||||
[show image](/reference/images/show-image),
|
[show image](/reference/images/show-image),
|
||||||
[scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)
|
[scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)
|
||||||
|
@ -36,7 +36,7 @@ input.onButtonPressed(Button.B, () => {
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[Getting Started](/reference/getting-started), [image](/reference/images/image),
|
[Getting Started](/getting-started), [image](/reference/images/image),
|
||||||
[create image](/reference/images/create-image),
|
[create image](/reference/images/create-image),
|
||||||
[create big image](/reference/images/create-big-image),
|
[create big image](/reference/images/create-big-image),
|
||||||
[scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)
|
[scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)
|
||||||
|
@ -56,5 +56,5 @@ for (let i = 0; i < img2.width() / 5; i++) {
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[show image](/reference/images/show-image), [image](/reference/image/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)
|
[show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ let brightness = led.brightness()
|
|||||||
|
|
||||||
### Math functions
|
### Math functions
|
||||||
|
|
||||||
The [math library](/reference/math) includes math related functions.
|
The [math library](/blocks/math) includes math related functions.
|
||||||
For example, the `absolute` function returns the returns the absolute value of input parameter `x`:
|
For example, the `absolute` function returns the returns the absolute value of input parameter `x`:
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
{
|
|
||||||
"Math.randomBoolean": "pick random true or false",
|
|
||||||
"String.fromCharCode": "text from char code %code",
|
|
||||||
"basic.clearScreen": "clear screen",
|
|
||||||
"basic.forever": "forever",
|
|
||||||
"basic.pause": "pause (ms) %pause",
|
|
||||||
"basic.showLeds": "show leds",
|
|
||||||
"basic.showNumber": "show|number %number",
|
|
||||||
"basic.showString": "show|string %text",
|
|
||||||
"control.inBackground": "run in background",
|
|
||||||
"control.reset": "reset",
|
|
||||||
"game.addScore": "change score by|%points",
|
|
||||||
"game.gameOver": "game over",
|
|
||||||
"game.score": "score",
|
|
||||||
"game.startCountdown": "start countdown|(ms) %duration",
|
|
||||||
"images.createBigImage": "create big image",
|
|
||||||
"images.createImage": "create image",
|
|
||||||
"input.acceleration": "acceleration (mg)|%NAME",
|
|
||||||
"input.buttonIsPressed": "button|%NAME|is pressed",
|
|
||||||
"input.compassHeading": "compass heading (°)",
|
|
||||||
"input.lightLevel": "light level",
|
|
||||||
"input.magneticForce": "magnetic force (µT)|%NAME",
|
|
||||||
"input.onButtonPressed": "on button|%NAME|pressed",
|
|
||||||
"input.onGesture": "on |%NAME",
|
|
||||||
"input.onPinPressed": "on pin|%NAME|pressed",
|
|
||||||
"input.pinIsPressed": "pin|%NAME|is pressed",
|
|
||||||
"input.rotation": "rotation (°)|%NAME",
|
|
||||||
"input.runningTime": "running time (ms)",
|
|
||||||
"input.setAccelerometerRange": "set accelerometer|range %range",
|
|
||||||
"input.temperature": "temperature (°C)",
|
|
||||||
"led.brightness": "brightness",
|
|
||||||
"led.plot": "plot|x %x|y %y",
|
|
||||||
"led.plotBarGraph": "plot bar graph of %value |up to %high",
|
|
||||||
"led.point": "point|x %x|y %y",
|
|
||||||
"led.setBrightness": "set brightness %value",
|
|
||||||
"led.stopAnimation": "stop animation",
|
|
||||||
"led.unplot": "unplot|x %x|y %y",
|
|
||||||
"music.beat": "%fraction|beat",
|
|
||||||
"music.changeTempoBy": "change tempo by (bpm)|%value",
|
|
||||||
"music.noteFrequency": "%note",
|
|
||||||
"music.playTone": "play|tone %note=device_note|for %duration=device_beat",
|
|
||||||
"music.rest": "rest(ms)|%duration=device_beat",
|
|
||||||
"music.ringTone": "ring tone (Hz)|%note=device_note",
|
|
||||||
"music.setTempo": "set tempo to (bpm)|%value",
|
|
||||||
"music.tempo": "tempo (bpm)",
|
|
||||||
"pins.analogReadPin": "analog read|pin %name",
|
|
||||||
"pins.analogSetPeriod": "analog set period|pin %pin|to (µs)%micros",
|
|
||||||
"pins.analogWritePin": "analog write|pin %name|to %value",
|
|
||||||
"pins.digitalReadPin": "digital read|pin %name",
|
|
||||||
"pins.digitalWritePin": "digital write|pin %name|to %value",
|
|
||||||
"pins.i2cReadNumber": "i2c read number|at address %address|of format %format=i2c_sizeof",
|
|
||||||
"pins.i2cWriteNumber": "i2c write number|at address %address|with value %value|of format %format=i2c_sizeof",
|
|
||||||
"pins.map": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh",
|
|
||||||
"pins.onPulsed": "on|pin %pin|pulsed %pulse",
|
|
||||||
"pins.pulseDuration": "pulse duration (µs)",
|
|
||||||
"pins.servoSetPulse": "servo set pulse|pin %value|to (µs) %micros",
|
|
||||||
"pins.servoWritePin": "servo write|pin %name|to %value",
|
|
||||||
"pins.setPull": "set pull|pin %pin|to %pull",
|
|
||||||
"serial.readLine": "serial read line",
|
|
||||||
"serial.redirect": "serial redirect to|TX %tx|RX %rx|at baud rate %rate",
|
|
||||||
"serial.writeLine": "serial|write line %text",
|
|
||||||
"serial.writeNumber": "serial|write number %value",
|
|
||||||
"serial.writeString": "serial write string %text",
|
|
||||||
"serial.writeValue": "serial|write value %name|= %value"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user