Fix some doc issues
This commit is contained in:
parent
918972ba6f
commit
8719f557aa
@ -108,7 +108,6 @@ In the ``||radio:on radio received||`` event, the temperature is received from s
|
|||||||
let temperature = 0
|
let temperature = 0
|
||||||
basic.showString("TEMPERATURE RADIO RECEIVER")
|
basic.showString("TEMPERATURE RADIO RECEIVER")
|
||||||
radio.setGroup(99)
|
radio.setGroup(99)
|
||||||
let temperature = 0
|
|
||||||
radio.onDataPacketReceived( ({ receivedNumber: temperature }) => {
|
radio.onDataPacketReceived( ({ receivedNumber: temperature }) => {
|
||||||
basic.showNumber(temperature)
|
basic.showNumber(temperature)
|
||||||
})
|
})
|
||||||
|
@ -142,7 +142,7 @@ Through this example, we have seen that the micro:bit scheduler enables you to c
|
|||||||
As a result, you can easily add a new capability to the micro:bit by just adding a new subprogram. For example, if you want to add a reset feature to the counter program, all you need to do is add a new event handler for a press of button B that sets the global variable "count" to zero, as shown below:
|
As a result, you can easily add a new capability to the micro:bit by just adding a new subprogram. For example, if you want to add a reset feature to the counter program, all you need to do is add a new event handler for a press of button B that sets the global variable "count" to zero, as shown below:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
export function countButtonPressesWithReset() {
|
function countButtonPressesWithReset() {
|
||||||
let count = 0
|
let count = 0
|
||||||
input.onButtonPressed(Button.A, () => {
|
input.onButtonPressed(Button.A, () => {
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
@ -21,7 +21,7 @@ We are creating a forever loop to constantly display the appropriate brightness
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let acceleration = input.acceleration("y")
|
let acceleration = input.acceleration(Dimension.Y)
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3. After storing the acceleration in a variable, write the code to take the absolute value of the acceleration, and store this value inside 'acceleration'.
|
## 3. After storing the acceleration in a variable, write the code to take the absolute value of the acceleration, and store this value inside 'acceleration'.
|
||||||
|
@ -15,7 +15,7 @@ Write the line of code to measure the acceleration and then store in it a variab
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let accX = input.acceleration("x")
|
let accX = input.acceleration(Dimension.X)
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: acceleration does not have be measured in the "x" direction. It can also be in the "y" or "z" direction.
|
Note: acceleration does not have be measured in the "x" direction. It can also be in the "y" or "z" direction.
|
||||||
@ -27,7 +27,7 @@ After storing the acceleration in a variable, write the code to show acceleratio
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let accX = input.acceleration("x")
|
let accX = input.acceleration(Dimension.X)
|
||||||
basic.showNumber(accX, 150)
|
basic.showNumber(accX, 150)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ Thanks for playing with Karel the LED!
|
|||||||
Copy this code into the JavaScript editor and then download it to the board.
|
Copy this code into the JavaScript editor and then download it to the board.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
const board = new Board();
|
||||||
/**
|
/**
|
||||||
* Karel the LED
|
* Karel the LED
|
||||||
*/
|
*/
|
||||||
@ -132,7 +133,6 @@ function updateLeds() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const board = new Board();
|
|
||||||
enum Direction {
|
enum Direction {
|
||||||
UP = 0,
|
UP = 0,
|
||||||
LEFT,
|
LEFT,
|
||||||
|
@ -15,7 +15,7 @@ pins.analogPitch(440, 300)
|
|||||||
## Example
|
## Example
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
pins.analogSetPitchPin("P0")
|
pins.analogSetPitchPin(AnalogPin.P0);
|
||||||
let frequency1 = 440
|
let frequency1 = 440
|
||||||
let duration = 1000
|
let duration = 1000
|
||||||
pins.analogSetPitchPin(AnalogPin.P1);
|
pins.analogSetPitchPin(AnalogPin.P1);
|
||||||
|
Loading…
Reference in New Issue
Block a user