Batch of fixes from the Lancaster doc review (#451)
* Local commit. * local commit * Doc fixes from Lancaster review. * I don't want to change these yet. * Trailing newlines, arrr. * Get the 'Game' cards setup. * Take block support off of 'show animation'. * Add 'see also' for showArrow().
This commit is contained in:
parent
5c82a0fcc6
commit
fa37f1fac0
@ -137,7 +137,6 @@
|
|||||||
* [clear screen](/reference/basic/clear-screen)
|
* [clear screen](/reference/basic/clear-screen)
|
||||||
* [forever](/reference/basic/forever)
|
* [forever](/reference/basic/forever)
|
||||||
* [pause](/reference/basic/pause)
|
* [pause](/reference/basic/pause)
|
||||||
* [plot leds](/reference/basic/plot-leds)
|
|
||||||
* [show arrow](/reference/basic/show-arrow)
|
* [show arrow](/reference/basic/show-arrow)
|
||||||
* [show animation](/reference/basic/show-animation)
|
* [show animation](/reference/basic/show-animation)
|
||||||
* [Input](/reference/input)
|
* [Input](/reference/input)
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
# @extends
|
# @extends
|
||||||
|
|
||||||
### #specific
|
### #specific
|
||||||
|
|
||||||
```
|
|
||||||
basic.forever(() => {});
|
|
||||||
```
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Basic
|
# Basic
|
||||||
|
|
||||||
Provides access to basic @boardname@ functionality.
|
Use basic @boardname@ functions and actions.
|
||||||
|
|
||||||
```cards
|
```cards
|
||||||
basic.showNumber(0);
|
basic.showNumber(0);
|
||||||
@ -18,13 +18,6 @@ basic.forever(() => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
basic.pause(100);
|
basic.pause(100);
|
||||||
basic.plotLeds(`
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . # . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
`);
|
|
||||||
basic.showArrow(ArrowNames.North);
|
basic.showArrow(ArrowNames.North);
|
||||||
basic.showAnimation(`
|
basic.showAnimation(`
|
||||||
. . . . .
|
. . . . .
|
||||||
@ -35,10 +28,10 @@ basic.showAnimation(`
|
|||||||
`);
|
`);
|
||||||
```
|
```
|
||||||
|
|
||||||
### See Also
|
### See also
|
||||||
|
|
||||||
[showNumber](/reference/basic/show-number),
|
[showNumber](/reference/basic/show-number),
|
||||||
[showIcon](/reference/basic/show-icon),
|
[showIcon](/reference/basic/show-icon),
|
||||||
[showLeds](/reference/basic/show-leds), [showString](/reference/basic/show-string),
|
[showLeds](/reference/basic/show-leds), [showString](/reference/basic/show-string),
|
||||||
[clearScreen](/reference/basic/clear-screen), [forever](/reference/basic/forever), [pause](/reference/basic/pause),
|
[clearScreen](/reference/basic/clear-screen), [forever](/reference/basic/forever), [pause](/reference/basic/pause),
|
||||||
[showAnimation](/reference/basic/show-animation)
|
[showArrow](/reference/basic/show-arrow), [showAnimation](/reference/basic/show-animation)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Show Animation
|
# show Animation
|
||||||
|
|
||||||
Show a group of image frames (pictures) one after another on the [LED screen](/device/screen). It pauses the amount of time you tell it after each frame.
|
Show a group of image frames (pictures) one after another on the [LED screen](/device/screen). It pauses the amount of time you tell it after each frame.
|
||||||
|
|
||||||
@ -14,8 +14,8 @@ basic.showAnimation(`
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `leds` is a [String](/types/string) that shows which LEDs are on and off, in groups one after another.
|
* `leds` is a [string](/types/string) that shows which LEDs are on and off, in groups one after another.
|
||||||
* `interval` is an optional [Number](/types/number). It means the number of milliseconds to pause after each image frame.
|
* `interval` is an optional [number](/types/number). It means the number of milliseconds to pause after each image frame.
|
||||||
|
|
||||||
### Example: Animating a group of image frames
|
### Example: Animating a group of image frames
|
||||||
|
|
||||||
|
@ -1,15 +1,41 @@
|
|||||||
# Game
|
# Game
|
||||||
|
|
||||||
A single-LED sprite game engine
|
Make games with sprites. Keep score and control gameplay.
|
||||||
|
|
||||||
|
## Sprites
|
||||||
|
|
||||||
|
```cards
|
||||||
|
game.createSprite(0,0);
|
||||||
|
game.createSprite(0,0).delete();
|
||||||
|
game.createSprite(0,0).move(0);
|
||||||
|
game.createSprite(0,0).turn(Direction.Left,0);
|
||||||
|
game.createSprite(0,0).ifOnEdgeBounce();
|
||||||
|
game.createSprite(0,0).get(LedSpriteProperty.X);
|
||||||
|
game.createSprite(0,0).set(LedSpriteProperty.X, 0);
|
||||||
|
game.createSprite(0,0).change(LedSpriteProperty.X, 0);
|
||||||
|
game.createSprite(0,0).isTouching(null);
|
||||||
|
game.createSprite(0,0).isTouchingEdge();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Scoring
|
||||||
|
|
||||||
```cards
|
```cards
|
||||||
game.addScore(1);
|
game.addScore(1);
|
||||||
game.score();
|
game.score();
|
||||||
game.startCountdown(10000);
|
|
||||||
game.gameOver();
|
|
||||||
game.setScore(0);
|
game.setScore(0);
|
||||||
```
|
```
|
||||||
|
|
||||||
### See Also
|
## Game control
|
||||||
|
|
||||||
[addScore](/reference/game/change-score-by), [score](/reference/game/score), [startCountdown](/reference/game/start-countdown), [gameOver](/reference/game/game-over), [setScore](/reference/game/set-score)
|
```cards
|
||||||
|
game.startCountdown(10000);
|
||||||
|
game.gameOver();
|
||||||
|
```
|
||||||
|
|
||||||
|
### See also
|
||||||
|
|
||||||
|
[createSprite](/reference/game/create-sprite), [move](/reference/game/move), [turn](/reference/game/turn),
|
||||||
|
[ifOnEdgeBounce](/reference/game/if-on-edge-bounce), [get](/reference/game/get), [set](/reference/game/set),
|
||||||
|
[change](/reference/game/change), [isTouching](/reference/game/touching) [isTouchingEdge](/reference/game/touching-edge),
|
||||||
|
[addScore](/reference/game/change-score-by), [score](/reference/game/score), [setScore](/reference/game/set-score),
|
||||||
|
[startCountdown](/reference/game/start-countdown), [gameOver](/reference/game/game-over)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# Get Sprite Property
|
# change Sprite Property
|
||||||
|
|
||||||
Change the kind of [number](/types/number) you say for a [sprite](/reference/game/create-sprite).
|
Change the kind of [number](/types/number) you say for a [sprite](/reference/game/create-sprite).
|
||||||
|
|
||||||
```sig
|
```sig
|
||||||
let item: game.LedSprite = null;
|
let item: game.LedSprite = null;
|
||||||
item.set(LedSpriteProperty.X, 0);
|
item.change(LedSpriteProperty.X, 0);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
@ -22,23 +22,8 @@ input.rotation(Rotation.Pitch);
|
|||||||
input.magneticForce(Dimension.X);
|
input.magneticForce(Dimension.X);
|
||||||
input.runningTime();
|
input.runningTime();
|
||||||
input.setAccelerometerRange(AcceleratorRange.OneG);
|
input.setAccelerometerRange(AcceleratorRange.OneG);
|
||||||
input.onLogoDown(() => {
|
|
||||||
|
|
||||||
});
|
|
||||||
input.onLogoUp(() => {
|
|
||||||
|
|
||||||
});
|
|
||||||
input.onScreenDown(() => {
|
|
||||||
|
|
||||||
});
|
|
||||||
input.onScreenUp(() => {
|
|
||||||
|
|
||||||
});
|
|
||||||
input.onShake(() => {
|
|
||||||
|
|
||||||
});
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### See Also
|
### See also
|
||||||
|
|
||||||
[onButtonPressed](/reference/input/on-button-pressed), [onGesture](/reference/input/on-gesture), [onPinPressed](/reference/input/on-pin-pressed), [buttonIsPressed](/reference/input/button-is-pressed), [compassHeading](/reference/input/compass-heading), [pinIsPressed](/reference/input/pin-is-pressed), [temperature](/reference/input/temperature), [acceleration](/reference/input/acceleration), [lightLevel](/reference/input/light-level), [rotation](/reference/input/rotation), [magneticForce](/reference/input/magnetic-force), [runningTime](/reference/input/running-time), [setAccelerometerRange](/reference/input/set-accelerometer-range), [calibrate-compass](/reference/input/calibrate-compass)
|
[onButtonPressed](/reference/input/on-button-pressed), [onGesture](/reference/input/on-gesture), [onPinPressed](/reference/input/on-pin-pressed), [buttonIsPressed](/reference/input/button-is-pressed), [compassHeading](/reference/input/compass-heading), [pinIsPressed](/reference/input/pin-is-pressed), [temperature](/reference/input/temperature), [acceleration](/reference/input/acceleration), [lightLevel](/reference/input/light-level), [rotation](/reference/input/rotation), [magneticForce](/reference/input/magnetic-force), [runningTime](/reference/input/running-time), [setAccelerometerRange](/reference/input/set-accelerometer-range), [calibrate-compass](/reference/input/calibrate-compass)
|
||||||
|
@ -14,7 +14,7 @@ led.enable(false);
|
|||||||
|
|
||||||
This program turns off the screen when pressing button ``B``
|
This program turns off the screen when pressing button ``B``
|
||||||
|
|
||||||
```typescript
|
```blocks
|
||||||
input.onButtonPressed(Button.B, () => {
|
input.onButtonPressed(Button.B, () => {
|
||||||
led.enable(false)
|
led.enable(false)
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,26 @@
|
|||||||
# Set Display Mode
|
# set Display Mode
|
||||||
|
|
||||||
Sets the display mode between black and white and greyscale for rendering [LEDs](/device/screen).
|
Set the display mode to either black and white or greyscale for rendering [LEDs](/device/screen).
|
||||||
|
|
||||||
```sig
|
```sig
|
||||||
led.setDisplayMode(DisplayMode.Greyscale)
|
led.setDisplayMode(DisplayMode.Greyscale)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The LED screen can create a sense of color depth with the display mode setting. Color depth is the difference in darkness between the pixels in the display. The `greyscale` mode makes the pixels appear
|
||||||
|
to have some amount of brightness to represent the grey value of real color. The `black and white` mode just shows an image on the pixels with the LEDs either on or off.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
* ``mode`` the display mode type. This is either `BlackAndWhite` or `GreyScale`.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Set the display mode to `black and white`.
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
led.setDisplayMode(DisplayMode.BackAndWhite)
|
||||||
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
[set brightness](/reference/led/set-brightness)
|
@ -1,6 +1,6 @@
|
|||||||
# Serial
|
# Serial
|
||||||
|
|
||||||
Reading and writing data over a serial connection.
|
Read and write data over a serial connection.
|
||||||
|
|
||||||
```cards
|
```cards
|
||||||
serial.writeLine("");
|
serial.writeLine("");
|
||||||
@ -23,4 +23,7 @@ serial.readBuffer(64);
|
|||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
|
||||||
[writeLine](/reference/serial/write-line), [writeNumber](/reference/serial/write-number), [writeValue](/reference/serial/write-value), [writeString](/reference/serial/write-string), [readLine](/reference/serial/read-line), [redirect](/reference/serial/redirect-to)
|
[writeLine](/reference/serial/write-line), [writeNumber](/reference/serial/write-number), [writeValue](/reference/serial/write-value),
|
||||||
|
[writeString](/reference/serial/write-string), [readUntil](/reference/serial/read-until), [readLine](/reference/serial/read-line),
|
||||||
|
[readString](/reference/serial/read-string), [onDataReceived](/reference/serial/on-data-received),
|
||||||
|
[redirect](/reference/serial/redirect-to), [writeBuffer](/reference/serial/write-buffer), [readBuffer](/reference/serial/read-buffer)
|
||||||
|
@ -111,6 +111,7 @@ namespace serial {
|
|||||||
/**
|
/**
|
||||||
* Sends a buffer through Serial connection
|
* Sends a buffer through Serial connection
|
||||||
*/
|
*/
|
||||||
|
//% blockId=serial_writebuffer block="serial|write buffer %buffer"
|
||||||
//% help=serial/write-buffer advanced=true weight=6
|
//% help=serial/write-buffer advanced=true weight=6
|
||||||
void writeBuffer(Buffer buffer) {
|
void writeBuffer(Buffer buffer) {
|
||||||
if (!buffer) return;
|
if (!buffer) return;
|
||||||
@ -120,9 +121,10 @@ namespace serial {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads multiple characters from the rxBuff and fills a user buffer.
|
* Reads multiple characters from the receive buffer and fills a user buffer.
|
||||||
* @param length default buffer length, eg: 64
|
* @param length default buffer length, eg: 64
|
||||||
*/
|
*/
|
||||||
|
//% blockId=serial_readbuffer block="serial|read buffer %length"
|
||||||
//% help=serial/read-buffer advanced=true weight=5
|
//% help=serial/read-buffer advanced=true weight=5
|
||||||
Buffer readBuffer(int length) {
|
Buffer readBuffer(int length) {
|
||||||
if (length <= 0)
|
if (length <= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user