Docsfix2 (#510)
* missing packages * fixing snippet issues * snippet fix * more doc fixes
This commit is contained in:
parent
3180229bce
commit
325ccce3a0
@ -100,22 +100,21 @@ Now we can use our LED lights to display different images depending on what butt
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
})
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
})
|
||||
```
|
||||
* Click on the individual little boxes in the ‘show leds’ block that is in the ‘on button A pressed’ event handler to create the image of a happy face.
|
||||
|
@ -23,145 +23,145 @@ https://youtu.be/VmD-dcZZQFc
|
||||
```blocks
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
if (128 > input.lightLevel() && 0 < input.lightLevel() && input.temperature() > 22) {
|
||||
basic.showAnimation(`
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# . . . #
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. # # # .
|
||||
# . . . #
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. # # # .
|
||||
# . . . #
|
||||
. # . # .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. # # # .
|
||||
# . . . #
|
||||
. # # # .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #
|
||||
`, 500)
|
||||
`)
|
||||
} else {
|
||||
basic.showAnimation(`
|
||||
basic.showLeds(`
|
||||
# . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. # . . .
|
||||
# # . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
# # # . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . # # .
|
||||
. . # . .
|
||||
# # # . .
|
||||
# . . # .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . # # #
|
||||
. . # . .
|
||||
# # # . .
|
||||
# . . # .
|
||||
# . . . #
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .
|
||||
`, 500)
|
||||
`)
|
||||
}
|
||||
})
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
if (input.temperature() < 22 && input.temperature() > 6) {
|
||||
basic.showAnimation(`
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . # . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
# # # # #
|
||||
`, 500)
|
||||
`)
|
||||
} else {
|
||||
basic.showAnimation(`
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . # . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. # # # .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`, 500)
|
||||
basic.showAnimation(`
|
||||
`)
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# . . . #
|
||||
# . . . #
|
||||
# . . . #
|
||||
# # # # #
|
||||
`, 500)
|
||||
`)
|
||||
}
|
||||
})
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
@ -303,8 +303,9 @@ This is an example of a board game in which the micro:bit displays an arrow poin
|
||||
Here is a portion of the board game's code. A boolean variable is used to determine whose turn it is. If player1Turn is false, then it's player 2's turn. A random number is generated to show the arrow seventy-five percent of the time (for values of 0, 1, or 2).
|
||||
|
||||
```blocks
|
||||
let player1Turn = false;
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
if (player1Turn == true && Math.random(4) < 3) {
|
||||
if (player1Turn == true && Math.random(4) < 3) {
|
||||
|
||||
}
|
||||
})
|
||||
|
@ -108,7 +108,7 @@ You can use the ``chromeserial=CHROMEID`` query argument to load your own Chrome
|
||||
* the editor will try to connect a port named ``serial`` ([source](https://github.com/Microsoft/pxt-microbit/blob/master/clients/chrome/background.ts#L73))
|
||||
* data can be sent back to the editor as JSON payloads ([source](https://github.com/Microsoft/pxt-microbit/blob/master/clients/chrome/background.ts#L42))
|
||||
|
||||
```typescript
|
||||
```typescript-ignore
|
||||
port.postMessage({
|
||||
type: "serial",
|
||||
data: decodedString,
|
||||
|
@ -82,4 +82,8 @@ basic.forever(() => {
|
||||
// setup the radio and start!
|
||||
radio.setGroup(4)
|
||||
game.addScore(1)
|
||||
```
|
||||
|
||||
```package
|
||||
radio
|
||||
```
|
@ -163,3 +163,7 @@ input.onButtonPressed(Button.A, () => {
|
||||
})
|
||||
radio.setGroup(1)
|
||||
```
|
||||
|
||||
```package
|
||||
radio
|
||||
```
|
@ -31,7 +31,6 @@ This is a follow up of the **[soil moisture project](/projects/soil-moisture)**.
|
||||
|
||||
* [Make](/projects/plant-watering/make)
|
||||
* [Code](/projects/plant-watering/code)
|
||||
* [Connect](/projects/plant-watering/connect)
|
||||
|
||||
### ~button /projects/plant-watering/make
|
||||
|
||||
|
@ -57,3 +57,7 @@ basic.forever(() => {
|
||||
```
|
||||
|
||||
https://youtu.be/7eC_VjH1eP0
|
||||
|
||||
```package
|
||||
radio
|
||||
```
|
@ -74,3 +74,7 @@ and uses the number received as the brightness of the LED.
|
||||
|
||||
When a message hasn't been received by a board for some time, it's pixel will start to blink. After more time, it will simply turn off.
|
||||
|
||||
|
||||
```package
|
||||
radio
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user