fixing references / snippets
cleanup "snippets" compilation state
This commit is contained in:
parent
fcefe1ed36
commit
bd1536132d
@ -41,8 +41,8 @@ In JavaScript, there is the concept of an *empty statement*, which is whitespace
|
|||||||
a semicolon in the context where a statement is expected.
|
a semicolon in the context where a statement is expected.
|
||||||
So, the following code is an infinite loop
|
So, the following code is an infinite loop
|
||||||
followed by a call to `showNumber` that will never execute:
|
followed by a call to `showNumber` that will never execute:
|
||||||
```typescript
|
```typescript-ignore
|
||||||
while(true) ;
|
while(true) ;
|
||||||
basic.showNumber(1);
|
basic.showNumber(1);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@ I'll be ${ age + 1 } years old next month.`
|
|||||||
This is equivalent to declaring `sentence` like so:
|
This is equivalent to declaring `sentence` like so:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
let fullName: string = `Bob Bobbington`;
|
||||||
|
let age: number = 37;
|
||||||
let sentence: string = "Hello, my name is " + fullName + ".\n\n" +
|
let sentence: string = "Hello, my name is " + fullName + ".\n\n" +
|
||||||
"I'll be " + (age + 1) + " years old next month."
|
"I'll be " + (age + 1) + " years old next month."
|
||||||
```
|
```
|
||||||
@ -82,7 +84,7 @@ A helpful addition to the standard set of datatypes from JavaScript is the `enum
|
|||||||
As in languages like C#, an enum is a way of giving more friendly names to sets of numeric values.
|
As in languages like C#, an enum is a way of giving more friendly names to sets of numeric values.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
enum Color {Red, Green, Blue};
|
enum Color {Red, Green, Blue}
|
||||||
let c: Color = Color.Green;
|
let c: Color = Color.Green;
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -91,14 +93,14 @@ You can change this by manually setting the value of one of its members.
|
|||||||
For example, we can start the previous example at `1` instead of `0`:
|
For example, we can start the previous example at `1` instead of `0`:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
enum Color {Red = 1, Green, Blue};
|
enum Color {Red = 1, Green, Blue}
|
||||||
let c: Color = Color.Green;
|
let c: Color = Color.Green;
|
||||||
```
|
```
|
||||||
|
|
||||||
Or, even manually set all the values in the enum:
|
Or, even manually set all the values in the enum:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
enum Color {Red = 1, Green = 2, Blue = 4};
|
enum Color {Red = 1, Green = 2, Blue = 4}
|
||||||
let c: Color = Color.Green;
|
let c: Color = Color.Green;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -6,43 +6,43 @@ a game similar to "Simon Says" with the BBC micro:bit.
|
|||||||
|
|
||||||
Complete the following guided tutorial. Your code should look like this:
|
Complete the following guided tutorial. Your code should look like this:
|
||||||
|
|
||||||
```blocks
|
```typescript
|
||||||
newAction() // ***
|
let action = 0;
|
||||||
|
function newAction() {}
|
||||||
input.onButtonPressed(Button.A, () => {
|
input.onButtonPressed(Button.A, () => {
|
||||||
if (action == 0) {
|
if (action == 0) {
|
||||||
game.addScore(1) // ***
|
game.addScore(1);
|
||||||
newAction() // ***
|
newAction();
|
||||||
}
|
}
|
||||||
}) // ***
|
})
|
||||||
input.onLogoDown(() => {
|
input.onLogoDown(() => {
|
||||||
if (action == 1) {
|
if (action == 1) {
|
||||||
game.addScore(1) // ***
|
game.addScore(1);
|
||||||
newAction()
|
newAction();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
input.onGesture(Gesture.Shake, () => {
|
input.onGesture(Gesture.Shake, () => {
|
||||||
if (action == 2) {
|
if (action == 2) {
|
||||||
game.addScore(1)
|
game.addScore(1);
|
||||||
newAction()
|
newAction();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
input.onButtonPressed(Button.B, () => {
|
input.onButtonPressed(Button.B, () => {
|
||||||
basic.showNumber(game.score(), 150) // ***
|
basic.showNumber(game.score(), 150);
|
||||||
basic.pause(2000) // ***
|
basic.pause(2000);
|
||||||
newAction() // ***
|
newAction();
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
### Challenge 1
|
### Challenge 1
|
||||||
|
|
||||||
Now let's add some more types of instructions for the player to follow. Let's add `PRESS PIN 0`. Change the global variable `action` to `math->random(4)` so that we can add a new **IF** statement that checks if `action=3`. If it does, display instructions to press pin 0.
|
Now let's add some more types of instructions for the player to follow. Let's add `PRESS PIN 0`.
|
||||||
|
Change the global variable `action` to `math->random(4)` so that we can add a new **IF** statement that checks if `action=3`. If it does, display instructions to press pin 0.
|
||||||
|
|
||||||
```blocks
|
```typescript
|
||||||
/**
|
let action = 0;
|
||||||
* {highlight}
|
|
||||||
*/
|
|
||||||
export function newAction() {
|
export function newAction() {
|
||||||
action = Math.random(4) // ***
|
action = Math.random(4)
|
||||||
if (action == 0) {
|
if (action == 0) {
|
||||||
basic.showString("PUSH A", 150) // ***
|
basic.showString("PUSH A", 150) // ***
|
||||||
}
|
}
|
||||||
@ -62,19 +62,22 @@ export function newAction() {
|
|||||||
|
|
||||||
Now let's implement `PRESS PIN 0` in the main. Create a condition of `input->on pin pressed("P0")` that will add one to the score and calls the method `new action`.
|
Now let's implement `PRESS PIN 0` in the main. Create a condition of `input->on pin pressed("P0")` that will add one to the score and calls the method `new action`.
|
||||||
|
|
||||||
```blocks
|
```typescript
|
||||||
// **. . .**
|
let action = 0;
|
||||||
|
export function newAction() {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
input.onButtonPressed(Button.B, () => {
|
input.onButtonPressed(Button.B, () => {
|
||||||
basic.showNumber(game.score(), 150) // ***
|
basic.showNumber(game.score(), 150)
|
||||||
basic.pause(2000) // ***
|
basic.pause(2000)
|
||||||
newAction() // ***
|
newAction()
|
||||||
}) // ***
|
})
|
||||||
input.onPinPressed(TouchPin.P0, () => {
|
input.onPinPressed(TouchPin.P0, () => {
|
||||||
if (action == 3) {
|
if (action == 3) {
|
||||||
game.addScore(1) // ***
|
game.addScore(1)
|
||||||
newAction() // ***
|
newAction()
|
||||||
}
|
}
|
||||||
}) // ***
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
### Challenge 3
|
### Challenge 3
|
||||||
|
@ -88,5 +88,5 @@ Have fun reviewing your simulation and analyze the acceleration by chart the Exc
|
|||||||
* Display acceleration with y or z using plot bar graph by changing acceleration from "x" to "y" or "z"
|
* Display acceleration with y or z using plot bar graph by changing acceleration from "x" to "y" or "z"
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -29,6 +29,7 @@ Write the line of code that will display the string "puppy" using `data->coll`.
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
|
let coll: string[] = []
|
||||||
basic.showString(coll[0], 150)
|
basic.showString(coll[0], 150)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ Write the line of code that will display the string "cat" using `data->coll`.
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
|
let coll: string[] = []
|
||||||
basic.showString(coll[2], 150)
|
basic.showString(coll[2], 150)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -44,5 +44,5 @@ radio.onDataReceived(() => { })
|
|||||||
* learn how to pause your code for the specified number of milliseconds
|
* learn how to pause your code for the specified number of milliseconds
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -164,5 +164,5 @@ Connect the second micro:bit to your computer using your USB cable and run the p
|
|||||||
The first person and second person take turns jumping in the “y” direction while the other player uses the micro:bit to track the results on the micro:bit!
|
The first person and second person take turns jumping in the “y” direction while the other player uses the micro:bit to track the results on the micro:bit!
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -35,5 +35,5 @@ radio.receiveNumber();
|
|||||||
* learn how to read the connector value as analog as a value comprised between 0 and 1023
|
* learn how to read the connector value as analog as a value comprised between 0 and 1023
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -196,5 +196,5 @@ Let's select Style 10 as an example.
|
|||||||
* Review and analyze the actual micro:bit device acceleration data on Excel
|
* Review and analyze the actual micro:bit device acceleration data on Excel
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -25,8 +25,9 @@ let randomArrow = Math.random(4)
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
|
let randomArrow = Math.random(4);
|
||||||
if (randomArrow == 1) {
|
if (randomArrow == 1) {
|
||||||
basic.plotImage(`
|
basic.showLeds(`
|
||||||
. . # . .
|
. . # . .
|
||||||
. . # . .
|
. . # . .
|
||||||
# # # # #
|
# # # # #
|
||||||
@ -43,8 +44,9 @@ if (randomArrow == 1) {
|
|||||||
<br />
|
<br />
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
|
let randomArrow = Math.random(4);
|
||||||
if (randomArrow == 2) {
|
if (randomArrow == 2) {
|
||||||
basic.plotImage(`
|
basic.showLeds(`
|
||||||
. . # . .
|
. . # . .
|
||||||
. . # # .
|
. . # # .
|
||||||
# # # # #
|
# # # # #
|
||||||
|
@ -61,5 +61,5 @@ radio.onDataReceived(() => {
|
|||||||
|
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
||||||
|
@ -90,5 +90,5 @@ Have fun reviewing your simulation and analyze the acceleration by chart the Exc
|
|||||||
* Display acceleration with y or z using plot bar graph by changing acceleration from "x" to "y" or "z"
|
* Display acceleration with y or z using plot bar graph by changing acceleration from "x" to "y" or "z"
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
||||||
|
@ -8,7 +8,6 @@ We now need to digitally write to pin ``P0`` as **high** (1).
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
pins.digitalWritePin(DigitalPin.P0, 1)
|
pins.digitalWritePin(DigitalPin.P0, 1)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2
|
### Step 2
|
||||||
@ -19,7 +18,6 @@ So insert the appropriate LED plot x, y.
|
|||||||
```blocks
|
```blocks
|
||||||
pins.digitalWritePin(DigitalPin.P0, 1)
|
pins.digitalWritePin(DigitalPin.P0, 1)
|
||||||
led.plot(2, 2)
|
led.plot(2, 2)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 3
|
### Step 3
|
||||||
@ -31,9 +29,7 @@ Then add a condition that occurs if we do not turn on a LED with plot x, y. We a
|
|||||||
if (input.buttonIsPressed(Button.A)) {
|
if (input.buttonIsPressed(Button.A)) {
|
||||||
pins.digitalWritePin(DigitalPin.P0, 1)
|
pins.digitalWritePin(DigitalPin.P0, 1)
|
||||||
led.plot(2, 2)
|
led.plot(2, 2)
|
||||||
} else {
|
} else { }
|
||||||
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +59,8 @@ basic.forever(() => {
|
|||||||
} else {
|
} else {
|
||||||
pins.digitalWritePin(DigitalPin.P0, 0)
|
pins.digitalWritePin(DigitalPin.P0, 0)
|
||||||
led.unplot(2, 2)
|
led.unplot(2, 2)
|
||||||
})
|
}
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 6
|
### Step 6
|
||||||
@ -87,9 +84,6 @@ basic.forever(() => {
|
|||||||
basic.clearScreen();
|
basic.clearScreen();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Your telegraph is ready!
|
Your telegraph is ready!
|
||||||
|
@ -37,9 +37,9 @@ bluetooth.onBluetoothConnected(() => {});
|
|||||||
```
|
```
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
microbit-devices
|
devices
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
@ -32,7 +32,7 @@ bluetooth.uartWriteValue("", 0);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
|
||||||
### Advanced
|
### Advanced
|
||||||
|
@ -95,5 +95,5 @@ https://www.youtube.com/watch?v=aep_GVowKfs
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
@ -96,5 +96,5 @@ If you do find yourself needing to pair again you will first need to remove the
|
|||||||
|
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
@ -33,5 +33,5 @@ http://www.youtube.com/watch?v=HyBcsD9Eh6I
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
@ -33,5 +33,5 @@ http://www.youtube.com/watch?v=HyBcsD9Eh6I
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -38,5 +38,5 @@ For more advanced information on the micro:bit Bluetooth accelerometer service i
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -42,5 +42,5 @@ For more advanced information on the micro:bit Bluetooth button service includin
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -36,5 +36,5 @@ For more advanced information on the micro:bit Bluetooth IO pin service includin
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -38,5 +38,5 @@ For more advanced information on the micro:bit Bluetooth LED service including i
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -39,5 +39,5 @@ For more advanced information on the micro:bit Bluetooth magnetometer service in
|
|||||||
|
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -39,6 +39,6 @@ For more advanced information on the micro:bit Bluetooth temperature service inc
|
|||||||
|
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -40,5 +40,5 @@ For more advanced information on the micro:bit Bluetooth UART service including
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -48,5 +48,5 @@ For more advanced information on the micro:bit Bluetooth UART service including
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -24,5 +24,5 @@ For more advanced information on the micro:bit Bluetooth UART service including
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -47,5 +47,5 @@ For more advanced information on the micro:bit Bluetooth UART service including
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -24,5 +24,5 @@ For more advanced information on the micro:bit Bluetooth UART service including
|
|||||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
bluetooth
|
||||||
```
|
```
|
||||||
|
@ -19,7 +19,7 @@ devices.onSignalStrengthChanged(() => {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-devices
|
devices
|
||||||
```
|
```
|
||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
@ -23,5 +23,5 @@ devices.onGamepadButton(MesDpadButtonInfo.ADown, () => {})
|
|||||||
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength), [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), [signal strength](/reference/devices/signal-strength), [on signal strength changed](/reference/devices/on-signal-strength-changed)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-devices
|
devices
|
||||||
```
|
```
|
@ -34,5 +34,5 @@ devices.onNotified(MesDeviceInfo.IncomingCall, () => {
|
|||||||
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [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)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-devices
|
devices
|
||||||
```
|
```
|
@ -34,5 +34,5 @@ devices.onSignalStrengthChanged(() => {
|
|||||||
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [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)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-devices
|
devices
|
||||||
```
|
```
|
@ -62,5 +62,5 @@ devices.raiseAlertTo("ring alarm")
|
|||||||
[tell remote control to](/reference/devices/tell-remote-control-to), [tell camera to](/reference/devices/tell-camera-to)
|
[tell remote control to](/reference/devices/tell-remote-control-to), [tell camera to](/reference/devices/tell-camera-to)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-devices
|
devices
|
||||||
```
|
```
|
@ -33,5 +33,5 @@ devices.onSignalStrengthChanged(() => {
|
|||||||
[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)
|
[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)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-devices
|
devices
|
||||||
```
|
```
|
@ -73,5 +73,5 @@ devices.tellCameraTo("stop video mode")
|
|||||||
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to)
|
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-devices
|
devices
|
||||||
```
|
```
|
||||||
|
@ -86,5 +86,5 @@ devices.tellRemoteControlTo("volume down")
|
|||||||
|
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-devices
|
devices
|
||||||
```
|
```
|
||||||
|
@ -33,12 +33,12 @@ basic.forever(() => {
|
|||||||
This program measures the temperature using Fahrenheit degrees.
|
This program measures the temperature using Fahrenheit degrees.
|
||||||
Fahrenheit is a way of measuring temperature that is commonly used in the United States.
|
Fahrenheit is a way of measuring temperature that is commonly used in the United States.
|
||||||
To make a Celsius temperature into a Fahrenheit one, multiply the Celsius temperature by
|
To make a Celsius temperature into a Fahrenheit one, multiply the Celsius temperature by
|
||||||
1.8 and add 32.
|
``18``, divide by ``10`` and add ``32``.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
let c = input.temperature()
|
let c = input.temperature()
|
||||||
let f = (c * 1.8) + 32
|
let f = (c * 18) / 10 + 32
|
||||||
basic.showNumber(f)
|
basic.showNumber(f)
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -20,7 +20,7 @@ radio.writeValueToSerial();
|
|||||||
```
|
```
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
@ -34,5 +34,5 @@ radio.onDataReceived(() => {
|
|||||||
[send number](/reference/radio/send-number), [set group](/reference/radio/set-group)
|
[send number](/reference/radio/send-number), [set group](/reference/radio/set-group)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -65,5 +65,5 @@ basic.forever(() => {
|
|||||||
[send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
[send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -91,5 +91,5 @@ radio.onDataReceived(() => {
|
|||||||
[send string](/reference/radio/send-string), [on data received](/reference/radio/on-data-received)
|
[send string](/reference/radio/send-string), [on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -40,5 +40,5 @@ basic.forever(() => {
|
|||||||
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -45,5 +45,5 @@ basic.forever(() => {
|
|||||||
[receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received)
|
[receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -42,5 +42,5 @@ A radio that can both transmit and receive is called a _transceiver_.
|
|||||||
[receive string](/reference/radio/receive-string), [on data received](/reference/radio/on-data-received)
|
[receive string](/reference/radio/receive-string), [on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -45,5 +45,5 @@ radio.onDataReceived(() => {
|
|||||||
[receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received)
|
[receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -35,5 +35,5 @@ radio.setGroup(128)
|
|||||||
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -40,5 +40,5 @@ radio.setTransmitPower(7)
|
|||||||
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -27,5 +27,5 @@ radio.setTransmitSerialNumber(true);
|
|||||||
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
@ -53,5 +53,5 @@ Sample output to serial when ``A`` button pressed:
|
|||||||
[on data received](/reference/radio/on-data-received)
|
[on data received](/reference/radio/on-data-received)
|
||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-radio
|
radio
|
||||||
```
|
```
|
Loading…
Reference in New Issue
Block a user